Introduction to df commands in Linux
The df command is known as the “disk free” command gives the estimation of the total amount of the disk memory space used by the input files and stored files in memory directories. It is used to measure and identify the memory usage of specific files and directories that take up a large sum of the disk memory usage. When we give a file name that is in the directory, the df will give the complete report of the memory usage of the disk in that directory. In this topic, we are going to learn about df Command in Linux.
df Command Usage & Syntax:
The basic syntax for the df command is:
df [OPTIONS]... [FILE]...
When there is no FILE that has been specified, then df will automatically report the usage of the disk memory in the current directory that we are working on. The memory usage of the disk is given in bytes of the given file or the directories memory usage where the file is located and also the subdirectories of that file when we execute the command without option.
We can give multiple file names and directory names as input to the df command:
The frequently used df options are,
The -a is an option that instructs to df to show the disk memory usage of total space in a file system.
df -a ~/Documents
The -h option is used to get the space usage and available disk space of a directory in a readable format (megabytes) in simple terms.
For instance, if we want the size of the home file directory and its subdirectories, the following command is run:
df -h /home/bala
If we use the -H option we get the memory usage in kilobytes.
df -H /home/bala
There is an option known as -t which is used for file types in a system.
df -t ext3
The following output is the complete list of all the filesystem in a specified extension.
An option called -x permits to exempt of the unspecified filesystems from showing in the output.
There is an Inode -i option that displays the complete information about a file directory. In a Linux system, a type of Data structure is called Inode.
df -ih /home
To get only a specific report on the size, name, and percentage of use of a particular filesystem we use –output option.
df -h -t ext3 --output=soure,size,pcent
There is an option called -total which gives the specified complete total of the filesystem.
There is a help option -help which can be used to get the reference or help
The df commands in a UNIX system or Linux system are primarily used for evaluating the space usage of a file. We have discussed the different command options and examples of disk memory usage outputs, which are given in a readable format, representing and giving the value of a filesystem, and also, we saw the commands used for estimating the total filesystem and filesystem types and folders on a disk. From these various command options, we got good knowledge and understanding of how to work with the df command.
df command is used to give the information about the disk space usage of the input file inside a system and du command gives the actual estimated amount of the disk memory space used up by the given directories or files. We can get the different command options that are available by typing the command man df at the terminal of our Linux system.
This is a guide to df Command in Linux. Here we discuss the df Command in Linux and examples of disk memory usage outputs. You can also refer to our other related articles to learn more –