Tuesday, July 8, 2008

Sort process by memory

The following command help to sort list of process running in linux machine.
ps -eo pmem,pid,args | sort -k 1 -n -r | less

pmem -> list the memory occupied by the process
pid -> process ID
args -> process

1 comment:

  1. We can also use the following command

    ps -e -orss=,args= | sort -b -k1,1n | pr -TW$COLUMNS

    this will sort every process by memory usage.