SSH commands to check Memory and Hard Drive usage information in Linux Server

Login to your server using SSH.

Run command to get information about memory usages.

# free -m

It will show you output like this:

total used free shared buffers cached
Mem: 24013 23461 551 0 214 21855
-/+ buffers/cache: 1391 22621
Swap: 12063 0 12063

Use the following command to check usages of Hard Drive and partitions:

# df -h

It will show you output like this:

Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg-root 904G 69G 790G 8% /
tmpfs 12G 0 12G 0% /dev/shm
/dev/sda1 243M 31M 200M 14% /boot
/dev/mapper/vg-tmp 1008M 34M 924M 4% /tmp

If you’d like to see the usage volume of a particular partition (ie, “/home”), use the following command:

# du -sh /home/

It will show you the usage in Gigabytes (or in Megabytes if usage is below 1 GB)
If you’d like to view the directory size in a particular partition (ie, “/home”):

# du -sh /home/*

The above will show you the size of all the directories in that partition.

Leave a Comment