Posts

Showing posts from March, 2018

Another interesting package - ps_mem

I find it hard to see what's using the RAM in a server and ps_mem can help.  It lets you know the memory usage of applications. I haven't found how to install it on Ubuntu, but on Red Hat and derivatives, it's available in the EPEL repo.  You can use it by simply executing the ps_mem command, which gives this kind of output: [root@vps1 ~]# ps_mem  Private  +   Shared  =  RAM used       Program   8.0 KiB +  24.0 KiB =  32.0 KiB       agetty (2)   4.0 KiB +  30.0 KiB =  34.0 KiB       xinetd   4.0 KiB +  49.5 KiB =  53.5 KiB       lvmetad   0.0 KiB +  73.5 KiB =  73.5 KiB       saslauthd (2)   8.0 KiB +  89.0 KiB =  97.0 KiB       pmdadm  16.0 KiB + 142.5 KiB = 158.5 KiB       systemd-udevd 128.0 KiB +  90.0 KiB = 218.0 KiB       pmdaxfs 152.0 KiB + 120.5 KiB = 272.5 KiB       crond 176.0 KiB + 104.5 KiB = 280.5 KiB       pmdaroot 108.0 KiB + 178.0 KiB = 286.0 KiB       avahi-daemon (2) 340.0 KiB + 128.0 KiB = 468.0 KiB       pmie 328.0 KiB + 330.0 KiB = 6

ncdu (NCurses Disk Usage)

Image
I discovered an utility a few weeks ago and I thought it would be worth sharing. This utility is especially useful when you are looking for files that take a lot of disk space on your system.  As an example, I received a Nagios notification saying that /var had less than 15% free.  I logged on the system to see what is taking too much space. In the past, I would have use the du command (du -hs /var/*, then du -hs /var/log/* and so on), but I used ncdu.  I cd'd into /var, then ran 'ncdu'. Here are screen shots of an example (different of what happened yesterday): This is what we see when we start ncdu in /var: We can use the arrows up and down to select a folder and use the left and right arrows to go up/down the tree. In this case, I simply used the right-hand side arrow a few times until I got to the folder that contains the most data: That's already great, but that's before digging into the help (using ?).  The options are (version 1.13): Sortin