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, 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.
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.
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.
diskutil list checks for the size of drives connected to your Mac.
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.