Main Menu

Search

LINUX: "ps" Command To List and Sort Particular User Processes (Application Process) 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 particular user by total memory usage. Below command shows PID's with Highest total used Memory (in MB) owned by particular user at the top and list goes down in descending order sorted by total memory usage.
ps -U <user> -wo rss=,comm= --sort -rss | while read -r rss comm ; do echo $((rss/1024))"MB -" $comm; done

In above command replace <user> with the username for which you want to list the processes sorted by total memory usage. 


For example if you want to list the the processes for "appuser" sorted by total memory usage, your command looks as follows:
ps -U appuser -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 appuser -wo rss=,comm= --sort -rss | while read -r rss comm ; do echo $((rss/1024))"MB -" $comm; done
5957MB - ora_dbw0_elctrl
2710MB - java
1957MB - ora_mman_elctrl
1157MB - mysqld
852MB - ora_cjq0_elctrl
488MB - java
467MB - ora_mmon_elctrl


Products to which Article Applies

All Linux Operating Systems


tarun boyella



No comments:

Post a Comment