which process is using up your memory using ps, awk, sort
The following command lists all the process sorted based on the used memory size.
$ ps aux | awk '{if ($5 != 0 ) print $2,$5,$6,$11}' | sort -k2n
PID VSZ RSS COMMAND
3823 3788 484 /sbin/mingetty
3827 3788 484 /sbin/mingetty
3830 3788 484 /sbin/mingetty
3833 3788 488 /sbin/mingetty
3834 3788 484 /sbin/mingetty
3873 3788 484 /sbin/mingetty
2173 3796 568 /usr/sbin/acpid
1835 3800 428 klogd
1832 5904 596 syslogd
2054 5932 540 /usr/sbin/sdpd
2281 6448 360 gpm
The above command lists the PID, Used virutal memory size, Used resident set-size and process command. The output is sorted on VSZ.
While debugging performance issues, use this command to find out which process is using up the memory.
Find out Top 10 Largest File or Directory Using du, sort and head
du command shows summarized disk usage for each file and directory of a given location (/var/log/*). The output of a sort command is reversely sorted based on the size.
# du -sk /var/log/* | sort -r -n | head -10
1796 /var/log/audit
1200 /var/log/sa
612 /var/log/anaconda.log
512 /var/log/wtmp
456 /var/log/messages.4
92 /var/log/messages.2
76 /var/log/scrollkeeper.log
72 /var/log/secure
56 /var/log/cups
48 /var/log/messages.1
No comments:
Post a Comment