Main Menu

Search

LINUX: "ps" Command To List and Sort ROOT User Processes By Total Memory Usage - In Descending Order PID's with Highest Total Memory Used At the Top (How To Doc)

Below "ps" command can be used to list and sort processes of root user by total memory usage. Below command shows PID's with Highest total used Memory (in MB) owned by root user at the top and list goes down in descending order sorted by total memory usage.
ps -U root -wo rss=,comm= --sort -rss | while read -r rss comm ; do echo $((rss/1024))"MB -" $comm; done

Below is example output of above command.

# ps -U root -wo rss=,comm= --sort -rss | while read -r rss comm ; do echo $((rss/1024))"MB -" $comm; done | more
4495MB - java
34MB - OSWatcher.sh
33MB - OSWatcher.sh
32MB - OSWatcher.sh
10MB - python

Products to which Article Applies

All Linux Operating Systems

tarun boyella

No comments:

Post a Comment