Checking RAM

I’m looking for an accurate way to check RAM memory of an application in terminal.
I know I can check free memory with: free -m for system.

How to do it per application without task manager?

Thanks

What is your definition of accurate memory /RAM usage?

Try this for a hint at memory size:

ps -eo size,pid,user,command --sort -size |     awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' |    cut -d "" -f2 | cut -d "-" -f1 | grep app_name

Purloined from:

and I added the final grep.

Examples:

$ ps -eo size,pid,user,command --sort -size |     awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' |    cut -d "" -f2 | cut -d "-" -f1 | grep firefox
       456.57 Mb /usr/lib/firefox/firefox 
       292.81 Mb /usr/lib/firefox/firefox 
       155.23 Mb /usr/lib/firefox/firefox 
       125.66 Mb /usr/lib/firefox/firefox 
        53.16 Mb /usr/lib/firefox/firefox 
         0.61 Mb grep firefox
$ ps -eo size,pid,user,command --sort -size |     awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' |    cut -d "" -f2 | cut -d "-" -f1 | grep zim
        62.95 Mb /usr/bin/python /usr/bin/zim 
         0.61 Mb grep zim
1 Like

There are programs like top, htop, and glances. They give a good overview of all resource usage, including RAM.

1 Like