Ravindra BagaleCourses & study guides

Chapter 4: Linux Advanced Commands

4.8 Disk and storage commands

df -h            # disk space per mounted filesystem (human readable)
df -Th           # include filesystem type (xfs, ext4)
sudo du -sh /var/log                    # total size of a folder
sudo du -h --max-depth=1 /var | sort -h # which sub-folder is big?
lsblk            # block devices (disks & partitions) as a tree
lsblk -f         # with filesystem type, UUID and mount point
sudo blkid       # UUIDs of all filesystems
findmnt /        # what is mounted at /
sudo mount /dev/nvme1n1 /data
sudo umount /data
cat /etc/fstab   # permanent mounts (read at boot)
free -h          # memory

/etc/fstab format (covered in depth in Chapter 13):

# <device>                                 <mount point> <type> <options>        <dump> <fsck>
UUID=3f1c2b9a-6d1e-4a5f-9c1e-2b7d8a9e0f11   /data         xfs    defaults,nofail  0      2