This article will outline how to check memory on linux and unix based machines. I’ll demonstrate a couple of useful commands that check memory on the hard drive on your machine.

df -h

df -h, which stands for disk free, checks for the space left on the drive in a human friendly format. It’s very useful to see the overall disk space left on the device.

df -h

Screen Shot 2015-08-18 at 9.39.52 PM

 

du -hs

The opposite of disk free is disk usage. du -hs, which stands for disk usage, checks for the space used on our device in a human friendly format. This command is less useful, but sometimes, instead of needing to look at the summary of memory on the hard drive, we only require looking at the disk space we have already used.

du -hs

Screen Shot 2015-08-18 at 9.36.53 PM

 

Checking overall memory across drives/partitions

Instead of checking memory on the main partition, you might want to look at the size of memory across all drives and partitions. Here’s where Mac’s and Linux machines differ.

Macs
diskutil list

diskutil list checks for the size of drives connected to your Mac.

Screen Shot 2015-08-18 at 11.08.58 PM

Linux
sudo fdisk -l

fdisk -l does a similar check like diskutil -l but for Linux machines. You may be prompted for your password because you need sudo user access.

Screenshot from 2015-08-18 23:11:53