Ps usage

From raju

sample commands

  • Display all processes
ps -fe | less
  • Display processes of some users
ps -fu user1,user2 | less
  • Show process by command name

If you know the exact command

ps -fC command

If you do not know the exact command

ps -fe | grep pattern
  • Sort processes
ps -ef --sort=-pcpu,+pmem

- indicates descending, + indicates ascending sort order.

ps -Ao user,uid,comm,pid,pcpu,etime,tty --sort=-pcpu | head -n 6

Ref: