Using the df command in Linux

Using the df command in Linux

The Linux team df provides a lot of useful information about file system usage, but contains quite a few options. NetworkWorld looks at the differences and makes some suggestions about when to use which command.

Team df stands for disk free. As the name suggests, it focuses on how much free disk space is available with a clear report like this:

By default, reports are in blocks of one kilobyte (1024 bytes per block) and all file systems are listed. You can have the command report on a single file system like this:

You can also request information by mount point name. This can make the command a bit easier.

One of the best options for this command is to request the data you want to view in a convenient format. This is analogous to telling your old friend that you are going to celebrate your 17th birthday and plan to take two weeks off to celebrate, and you will have to drive 7 hours to get to the resort where you plan to stay.

It would be much more difficult to report all these events in one unit of time. Here’s an example of the above report in an easy-to-read format:

Team df also provides some other useful options. For example, to report the file system type, you can run the following command:

The following command only applies to btrfs file systems:

Alternatively, if you just want to report on inodes (small data structures that describe file system objects such as files and directories on Linux systems), you can use the following command:

Note that in the output above, the user files are mounted in the /run/user. You can focus on a single file system or partition with the following command:

If you use the parameter -a with the team df, you may be in for a surprise. It will include pseudo, duplicate and even inaccessible file systems. The example below shows just the top of the range of output you’re likely to see.

This is less than one third of the total available production. Here is a command that will count the lines in the full output of the command:

Results

Team df very useful for checking the space usage of your file system. This is something you should do from time to time to make sure you don’t run out of disk space.

Previously, ProIT told ​how to use the history command in Linux.

Read also on ProIT: Linux Mint 21.3 Virginia is now available for download. What’s new?

Related posts