1. Home
  2. How to find out how much disk space is remaining in Linux?

How to find out how much disk space is remaining in Linux?

Admin Posted on January 13th 2024, Last Updated on August 12th 2024

Check Linux Disk Space Using df Command:

$ df

df shows the amount of free space that is left on a file system.

$ df -h

The -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:

Space Used

Total amount of space that is allocated to existing files in the file system.

Space Free

Total amount of space available in file system for the creation of new files by unprivileged users.

Space Reserved

Space reserved by the system, which is not normally available to a user.

Total Space

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

The 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 -s option:

$ du -hs

 

To display a complete list of options, use either df --help or du --help.

 

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.

 

$ pydf

 

$ discus

 

$ di