ps

linux

http://www.cyberciti.biz/tips/top-linux-monitoring-tools.html

ps -C /usr/sbin/httpd -o pid,%mem,%cpu,vsz,cmd --sort=vsz
ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10
ps -eo pcpu,pid,user,args | sort -r -k1 | less 

ps -aux | grep chavez

ps command displays every process (-e) with a user-defined format (-o pcpu). First field is pcpu (cpu utilization). It is sorted in reverse order to display top 10 CPU eating process.

ps -A
ps -Al  // show long format
ps -AlF // turn on extra full mode (it will show command line arguments passed to process)
ps -AlFH // display threads (LWP and NLWP)
ps -AlLm // to see threads after processes
ps ax // print all processes on the server
ps axu // print all processes on the server
ps -ejH // print a process tree
ps axjf // print a process tree
pstree
ps -eo euser,ruser,suser,fuser,f,comm,label  // print security related information
ps axZ
ps -eM

What are the command line options for the ps command on BSD?

ax    // displays all system processes
c    // display the actual command name
e    // display the environment as well as the command run
w    // widen the output format

What are the command line options for the ps command on System V?

-e    // display all system processes
-f    // produce a full listing, including process start time

Other information:

ps aux

USER, PID, %CPU, %MEM, SZ, RSS, TTY, STAT(s), TIME, COMMAND
  • SZ: Virtual memory used
  • RSS: Real memory used
  • STAT(s):
    • R: Running or Runnable
    • S: Sleeping
    • I: Idle (BSD)
    • T: Stopped
    • Z: Zombie process
    • D: Disk wait (BSD)
    • P: Page wait (BSD)
    • X: Growing (waiting for memory) (System V)
    • K: Available kernel process (AIX)
    • W: Swapped out (BSD)
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License