5 df command usages each Programmer ought to study
1. the right way to discover how a lot house left within the partition
Should you merely kind df -h and provides present listing like proven in following command then it
gives you dimension of present partition and the way a lot is crammed and the way a lot house is left as proven in beneath output. You’ll be able to see that the /dev/root partition has 4.9G of house, out of these 2.3G is used and a pair of.6G is offered.
That is additionally my go to command as a result of most o the time you do not know the partition title and you’re simply within the present partition.
2. the right way to discover dimension of all patriations
For example you do not need to know dimension of present partition however another one which is shared between groups. Now, you do not bear in mind the partition title however you understand that it’s mounted together with your host. On this case, you may merely execute the next df command to get dimension of all partitions.
I hope you acknowledge the partition once you see within the output although. In earlier command solely utilization of present partition was current however on this instance you may see the disk utilization element of each single partition mounted on the host, together with NFS
As soon as once more, the -h choice is to print dimension of partitions in human readable format e.g. G for giga bytes and M for Mega bytes. Should you want dimension in 1K block, you may merely execute df command with out -h choice.
3. The right way to discover dimension of a selected partition in Linux?
If you understand the partition title and you have an interest on both dimension of the partition or how a lot full or empty it’s, you may merely execute the next df command to seek out the scale or house left in a selected partition
The above command will print file system, dimension, and utilization particulars for partition /choose/run within the present host.
Right here is an instance of this command
You’ll be able to see that after we handed /dev mount level then it print the scale of devtmpfs file system. The important thing right here is to move the mount level, (see the mounted on column in above outupt) and never the title of partition.
4. Print dimension of native file techniques solely
While you print dimension of all partitions utilizing df command it print sizes for each native and distant file techniques. Should you as a substitute, simply on dimension of location file techniques then you need to use the next df command:
The -l choice is for printing utilization element of solely native file techniques.
5. The right way to print kind of the file system
If you wish to know which kind of file system you’re presently on, you need to use the df -T to print the kind of file techniques. A number of the frequent sorts are “nfs”, which is for NFS file system i.e. one mounted over a community from one other machine.
Others are ufs, efs, ext3 that are largely used for native file techniques, a file system on a locally-mounted laborious disk. Not often you will notice one thing like hsfs or cdfs which stands for a file system on a CD-ROM drive.
output
On this output you may see that one file system is 9p whereas different is native. If you’re on the kind of your present file system them simply execute following command
This can print the kind of your present file system or partition.
That is all about important df command examples in Linux and UNIX. It is among the important command for any Linux consumer and really helpful to verify the disk utilization. You usually end up utilizing “df” and “du” command in tendon to verify how a lot house left in a file-system, partition or in a given listing.
Thanks for studying this text to date. Should you discover these df command examples helpful, then please share it with your mates and colleagues. Should you
have any questions or suggestions, then please drop a word.
P. S. – If you wish to enhance your Linux command abilities, then I additionally recommend you take a look at these greatest on-line Linux programs
from Udemy and Coursera. It is a fantastic course for everybody, and you’ll
undoubtedly study some helpful tricks to work higher on Linux.