Which process was consuming most memory in the Past?

Hello

There are options / commands to check which process is consuming maximum memory

However is there any command/mechanism which will tell us which process was consuming maximum memory in specific time interval in the past?

I heard nmon report can help in this regard.

is there any other option available?

Thanks and Regards
Chetanz

Output from ps is normally good. Try :-

ps -el|sort -n +9
ps -el|sort -n -k10

Depending on your operating system and version, the sort will probably fail on one of these two. Process id is usually in column 3. If this looks totally useless, try getting the column headers and adjusting the column sorted on:-

ps -el|head -5

I hope that this helps.

Robin
Liverpool/Blackburn
UK

Once a process exits, the information about its memory usage goes away, unless you have been monitoring it and storing the result in a file. There is no default performance history unless YOU create it as it happens. YOU get to provide timestamps to that data as well. There are lots of good, free monitoring tools.

rbatte1's result works correctly. But only for processes that have not yet exited. So if you have a long running process that has a lot of memory allocated, it will show.

Hello Robin,

I have just tried the following command and I am NOT able to see any CPU utilization column there, could you please help in same.

$ ps -el|sort -n +9
       F S   UID      PID     PPID   C PRI NI ADDR    SZ    WCHAN    TTY  TIME CMD

Thanks,
R. Singh

@Ravinder
The thread is about memory and not about CPU. Use other switches for ps to see CPU usage statistics.
If your question is not related to the topic of the thread, open up your own thread, thanks.

@Chetanz
Why not use nmon? It is really helpful collecting your performance stats and easy to set up. With nmon2rrd you can create graphs from the collected data.

nmon
nmon2rrd

For monitoring: nmon (1..10), xymon (10...100), nagios (50...) (number of monitored systems)
For an ad-hoc snapshot and debugging, I suggest the Posix format where you can specify the columns.
Examples for top 3 memory consumers:

ps -eo pid,rss,vsz,comm | { IFS= read line; echo "$line"; sort -nrk2; } | head -4
ps -e -o pid= -o rss= -o vsz= -o comm= | sort -nrk2 | head -3
1 Like