← ../


list the current running processes with relevant details.

you can apply many formating options and filters.

# a common way to list all processes is
ps -ef

# my personal favorite format is by using the BSD options (provide more details)
ps aux

# which is equivalent to:
ps -eo user,pid,%cpu,%mem,vsz,rss,tname,stat,bsdstart,time,command

all the above fields are important and useful, but I will add emphasis on the stat and bsdstart fields.

possible process status are :

D uninterruptible sleep (usually IO)
I Idle kernel thread
R running or runnable (on run queue)
S interruptible sleep (waiting for an event to complete)
T stopped by job control signal
t stopped by debugger during the tracing
W paging (not valid since the 2.6.xx kernel)
X dead (should never be seen)
Z defunct ("zombie") process, terminated but not reaped by its parent

here are some other commands you can chain with ps to get useful values :

check the top 10 processes by cpu usage

ps aux | head -1; ps -aux | sort -nr -k 4 | head -10
ps -A --sort -rss -o comm,pmem | head -n 11

check the top 10 processes by cpu usage

ps -eo pcpu,pid,user,args | sort -k 1 -r | head -1