How to find out how much disk space is remaining in Linux?Posted on Posted on January 13th 2024, Last Updated on February 20th 2024
Check Linux Disk Space Using df Command:
df shows the amount of free space that is left on a file system.
$ df -h
-h flag provides human readable output (which makes reading of the output - easier).
This displays the size in kilobytes (K), megabytes (M), and gigabytes (G).
Space can have the following values:
Total amount of space that is allocated to existing files in the file system.
Total amount of space available in file system for the creation of new files by unprivileged users.
Space reserved by the system, which is not normally available to a user.
Includes space used, space free, and space reserved.
Display File Systems by Type:
To list all file systems by type, use the command:
df -ht ext4
This lists drives with the
ext4 type, in human-readable format.
Check Disk Space in Linux With du Command:
du command displays disk usage.
$ du -h
The -h flag provides human readable output. It displays a list of the contents of the current directory, and how much space they’re using. You can simplify the display with the
$ du -hs
To display a complete list of options, use either
df --help or
Here are some more commands you could explore:
$ du -sh <dir>
For example, du -sh /home/mark will show a summarised usage report in human-readable output for /home/mark.
$ ncdu -x /
ncdu -x / will analyze disk usage on root partition without crossing filesystem boundaries.
You can also use ncdu (available directly from the Ubuntu repos) which use the ncurses library for showing a graphical overview directly in the terminal.