How to Check Disk Space Linux
 | Quick Guide 2022

How to Check Disk Space Linux | Quick Guide 2022

Linux can help you check disk space on your system.

2. Linux Tutorials | How to Check Linux Disk Space | Linux DF and DU Commands | How to Clear Space

How to Check Disk Space in Linux

In this article, we will be discussing how to check disk space in Linux. This can be useful if you want to check how much space is used on your hard drive, or if you want to free up space on your hard drive so that you can install new software or install updates to existing software.

To check disk space in Linux, you will first need to open a terminal. To open a terminal in Linux, press the “Ctrl+Alt+T” keys at the same time to open the “Terminal” application. Once you have opened the terminal, type the following command to check disk space:

df

  • h

    This will output a list of all the files and folders on your hard drive. The first column in the list will be “Free Space” and the second column will be “Used Space”. You can use these values to see which files or folders are taking up the most space on your hard drive.

    For example, if you want to free up space on your hard drive so that you can install new software, you can type the following command to delete the files that are taking up the most space on your hard drive:

    sudo rm

  • rf /

    This will free up the space on your hard drive and you can now install the new software.

Checking Disk Space from the Command Line

Checking disk space can be a tedious task, especially if you want to check specific folders or files. Thankfully, there are a number of command line tools that can help.

In this article, we’re going to take a look at two of the most popular disk space checking tools: df and du.

df

The df command tells you how much space is currently available on your computer’s hard drive. You can use it to see how much space is occupied by files, folders, and subdirectories.

Here’s an example:

$ df

Filesystem Size Used Avail Use% Mounted on

/dev/sda1 191G 53G 136G 49% /

tmpfs 7.4K 0 7.4K 0% /run

/dev/sda8 191G 53G 136G 49% /home

This command output shows that the /dev/sda1 filesystem holds 191GB of data, the /run file system holds 7.4GB, and the /home filesystem holds 53GB.

The % used column tells you how much of the total space on the drive is currently being used. The Avail column shows you how much space is available on the drive.

If you want to see how much space is used by a specific directory, you can use the

  • d flag. For example:

    $ df

Checking Disk Space with the du Command

Once you have determined that your Linux system is low on disk space, you can take corrective action by checking for and removing unused files. To check for disk space usage on a local system, you can use the du command. The du command prints the size of each directory and its subdirectories, as well as the total size of the file system.

The du command can also be used to check the status of files and directories. For example, if you want to know the size of a file, you can use the du command followed by the file name. The du command will also show you the percentage of the file’s size that is occupied by the file’s contents.

If you want to check the disk space usage of a remote system, you can use the ssh command. The ssh command will connect to the remote system and use the du command to display the disk space usage of the remote system.

Checking Disk Space with the df Command

The df command can be used to check disk space on Linux. The syntax of the df command is as follows:

df [options]

The options that can be used with the df command are as follows:

-h, –human-readable Display the disk space in human-readable format
-L, –long Display the disk space in long format
-m, –megabytes Display the disk space in megabytes
-g, –GB Display the disk space in GB
-t, –terabytes Display the disk space in terabytes
-p, –percent Display the disk space in percent
-o, –output Format the output in a specific format (default is table)

When checking disk space on a Linux system, the df command will report on the size of each partition, the size of the root filesystem, and the total disk space. The root filesystem will be reported as the size of the smallest filesystem that is larger than any other filesystem on the system.

How to Check inode Usage in Linux

In Linux, filesystems are divided into inodes. Inodes are linked together and contain information about the files and directories on the filesystem. Each inode also stores a reference to the file’s data block(s). Filesystems use inodes to keep track of where data blocks are and how many blocks each file occupies.

When you check the disk space in Linux, you use the ls -l command to display a list of the files and directories on your filesystem. The -l option shows the size of each file and the inode number for each file. The inode number is listed first, followed by the file’s size. For example, the following ls -l command displays the inode numbers and sizes for the files in the directory /home/skippy/Desktop:

total 8
-rw-r–r– 1 skippy skippy 38 May 14 14:11 Desktop
lrwxrwxrwx 1 skippy skippy 30 May 14 14:11 Desktop -> ../../../sbin/mdadm
-rw-r–r– 1 skippy skippy 214 May 14 14:11 Desktop/README.txt
-rw-r–r– 1 skippy skippy 10 May 14 14:11 Desktop/license.txt
-rw-r–r– 1 skippy skippy 3 May 14 14:11 Desktop/setup.sh
-rw-r–r

Checking Disk Space with the findmnt Command

Disk space checking with the findmnt command can be used to check for free and used space on a Linux system, as well as to list the contents of specific directories. By default, the findmnt command examines the root directory of the system, but it can be directed to examine other directories using the

  • type option.

    To check for free space on a Linux system, use the findmnt command with the

  • type f option. This will check the size of the current directory and all of its subdirectories and report any free space that is available.

    To check for used space on a Linux system, use the findmnt command with the

  • type u option. This will check the size of the current directory and all of its subdirectories and report the number of files that are currently in use. The findmnt command can also be used to list the contents of a specific directory. To do this, use the findmnt command with the
  • type d option and specify the name of the directory that you want to examine.

Conclusion

With the recent release of Ubuntu 16.04 LTS, the popular Linux distribution now comes with a new tool called ‘df’. As the name suggests, this tool helps you check the disk space on your system.

If you’re like most people, you’re probably not familiar with df. In this blog post, we’ll show you how to use df to check your disk space, and how to prevent running out of space on your system.

Related Posts

Leave a Reply

Your email address will not be published.