
The ps stands for process status and it is a handy tool used to retrieve the information about currently running processes on Linux or BSD systems. This cheatsheet collets the most useful ps invocations.
Show all processes
ps auxShow all processes including commandline arguments
ps -AFlShow all processes with threads in tree mode
ps -AlFHShow processes in a hierarchy
ps -e -o pid,args --forestShow list of processes owned by a specific user
ps -U user -u user uShow information for a particular process
ps -p pid ps uax | grep process_nameShow all threads for a particular process by id
ps -p pid -L -o pid,tid,pcpu,state,commGet top 5 processes by CPU usage
ps -e -o pcpu,cpu,nice,state,cputime,args --sort pcpu | sed '/^ 0.0 /d'| tac |head -5 ps auxf | sort -nr -k 3 | head -5Get top 5 processes by memory usage
ps -e -orss=,args= | sort -b -k1,1n | pr -TW$COLUMNS| tac | head -5 ps auxf | sort -nr -k 4 | head -5Get security info
ps -eo euser,ruser,suser,fuser,f,comm,label Related Posts: