You are not logged in.
I would like to see a list of current proesses and the amount of RAM they are using sorted by the RAM usage. i.e.
100MB's openbox
50MB's firefox
etc...
I can use htop to view RAM % but not MB's (To my knowledge). Is there a program to do this?
Thanks
Last edited by Midasx (2013-01-29 19:03:48)
Offline
This python script is quite useful :
http://www.pixelbeat.org/scripts/ps_mem.py
execute it like this:
$ sudo python scriptname
Last edited by illusionist (2013-01-29 18:05:43)
Never argue with stupid people,They will drag you down to their level and then beat you with experience.--Mark Twain
@github
Offline
Have you tried changing the memory column to something more useable in htop?
F2 -> Columns -> M_RESIDENT and M_SIZE?
I've got:
PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command
518 root 20 0 176M 78340 46984 R 25.4 0.5 7:52.26 /usr/bin/X
3030 user 20 0 590M 106M 42900 S 25.4 0.7 2:49.20 /usr/lib/chromiu
WHere RES shows M for Mb of ram?
IIRC htop converts bytes to Kb (not KB) automatically if the bytes exceeds 1024, and if that exceeds it converts to Mb and so on.
Last edited by Torxed (2013-01-29 18:02:08)
Offline
This python script is quite useful :
http://www.pixelbeat.org/scripts/ps_mem.pyexecute it like this:
$ sudo python scriptname
I seem to get a syntax error with that script
./ps_mem.py
File "./ps_mem.py", line 138
except getopt.GetoptError, e:
^
SyntaxError: invalid syntax
Have you tried changing the memory column to something more useable in htop?
F2 -> Columns -> M_RESIDENT and M_SIZE?
I've got:PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command 518 root 20 0 176M 78340 46984 R 25.4 0.5 7:52.26 /usr/bin/X 3030 user 20 0 590M 106M 42900 S 25.4 0.7 2:49.20 /usr/lib/chromiu
WHere RES shows M for Mb of ram?
IIRC htop converts bytes to Kb (not KB) automatically if the bytes exceeds 1024, and if that exceeds it converts to Mb and so on.
I had a tinker with htop settings but nothing gave me a clear display unfortunately. I did get to tweak some settings though
Last edited by Midasx (2013-01-29 18:14:34)
Offline
Here is the version of the script I am using :
http://pastebin.com/8pKtGtyk
Execute it like I posted.
Never argue with stupid people,They will drag you down to their level and then beat you with experience.--Mark Twain
@github
Offline
while read command percent rss; do
if [[ "${command}" != "COMMAND" ]]; then
rss="$(bc <<< "scale=2;${rss}/1024")";
fi;
printf "%-26s%-8s%s\n" "${command}" "${percent}" "${rss}";
done < <(ps -A --sort -rss -o comm,pmem,rss | sed -n 1,11p)
Example output:
COMMAND %MEM RSS
firefox 32.4 323.56
urxvtd 2.4 24.24
mplayer 1.8 18.50
plugin-containe 1.8 18.23
X 1.3 13.12
vim 0.4 4.67
bash 0.2 2.85
bash 0.2 2.84
bash 0.2 2.84
bash 0.2 2.83
You can tweak it to show all processes, not just the top ten, omit %MEM etc.
Last edited by karol (2013-01-29 19:00:08)
Offline
Here is the version of the script I am using :
http://pastebin.com/8pKtGtyk
Execute it like I posted.
Ah that works now, thank you
Offline