Getting information about the mounts and disks associated with your operating system is a crucial task while operating the system. It helps you to manage different resources and remove unnecessary files when needed. In this article, we will discuss various examples and options related to df command utility in Linux.
What is a FileSystem
The filesystem of the operating system is the way it handles and stores the data on the hard drive and accesses it when needed. The layout and orientation of the file system largely impact the efficiency of data manipulation operations in an Operating system. The name of the default filesystem for Windows OS is NTFS.
What is Mounting of FileSystem
Mounting implies connecting your external drive to your computer so that your operating system can identify it and execute data processing with the disc straight away. If you can locate your drive in your operating system's file explorer, it implies it is "mounted."
What is df command in Linux?
The df command is a strong Linux terminal tool for getting vital information about your filesystem's disc space. It is widely used by system administrators to monitor and assess real-time server or network-oriented systems. The syntax of df command in Linux is:
df [options] [file]
Below is an example of using the command without any option and filename:
With no filename given, it displays available space on all mounted file systems.
Get mount information of a file
We can also specify the name of the file and get the mount information of that file.
Below is an example of getting mount information from the “test.txt” file:
To display all filesystems, use the -a option with the command as shown below with an example.
Get filesystem type
To get the filesystem type, use -T option with the command.
An illustration for this is:
Get filesystem sizes in the power of constants
To display filesystem sizes in power of 1024, use -h option
To display filesystem sizes in the power of 1000, use the -H option
In this article, we discussed various examples and demonstrations using df command in the Linux utility. This command helps to get information related to the disk and mounts of our operating system. It's always necessary to get mounting and space information related to your filesystem in order to stay updated on your disk usage and update it if necessary. df command also provides features like getting filesystem size, listing file systems, and mounting information of a set of files of the operating system.
People are also reading: