The Full Hard Drive
If you are managing a headless Ubuntu Linux server, there is no graphical File Explorer to right-click and check how much hard drive space you have left. If a rogue log file or an out-of-control database backup completely fills your server’s primary partition, the entire operating system will violently crash because it can no longer write critical temporary files to the disk. To prevent this, system administrators must constantly monitor the storage capacity of all connected hard drives directly from the command line.
Using the df Command
The Linux df (Disk Free) command instantly audits every single partition and outputs the remaining storage space.
- Open your Terminal application (Ctrl + Alt + T) or log into your server via SSH.
- To view the storage capacity of all connected drives, type the following command exactly:
df -h- Press Enter.
Human-Readable Output
The -h (Human-readable) flag is absolutely essential. If you just type df by itself, Linux will output the storage space in raw 1-kilobyte blocks (meaning a 2-terabyte drive will display as a massive string of numbers that is impossible to read quickly). By adding the -h flag, the terminal automatically converts those massive numbers into recognizable Megabytes (M), Gigabytes (G), and Terabytes (T). Look specifically at the column labeled “Use%” and the row ending in a single forward slash (/), which represents your primary operating system drive.