Saturday, August 14, 2010

PS command: Memory and CPU Usage

we can use ps command to get the details of processes running on system in a efficient manner. 

This is useful when you are monitoring system processes.

# ps -eo s,pid,ppid,user,group,rss,vsz,pcpu,pmem,time,etime,tty,args

A brief explanation of output:
S: State of the process
-----------> S: Sleeping,
-----------> O: Runing on processor,
-----------> R: Runnable (it is in run queue),
-----------> Z: Zombie,
-----------> T: Stopped process (either by a job control signal or because it is being traced)
PID: Process ID
PPID: Parent process ID
USER: User name who initiated process
GROUP: Group name from whom user belong/currently launched the job
RSS: The resident set size of the process, in kilobytes.
VSZ:The total size of the process in virtual memory, in kilobytes.
%CPU: Total % of CPU taken by this process
%MEM: Total % of Memory taken by this process
TIME: the cumulative CPU time of the process in the form
ELAPSED: Total time elapsed since this process is live
TT: Terminal ID
COMMAND: Command/daemon/process with args