Saturday, April 20, 2024
HomeJava5 Examples of df command in Linux

5 Examples of df command in Linux


The df command is used to seek out the quantity of disk house used and obtainable on completely different partitions and file techniques. The only instance of df command is simply typing df on console with out any arguments and it’ll present you the house used and obtainable on all presently mounted file techniques of every kind e.g NFS, ext3 and each native and distant. Alternatively you may ask df command to print the scale and house obtainable and used for a selected partition. Usually the disk house is printed in items of 1024 bytes, however this may be overridden. I generally use df -h choice to print the scale and disk utilization in human readable format e.g. G for giga bytes, M for mega bytes and so forth. 
Up to now, I’ve shared instance of many frequent Linux instructions like discover, grep, netstat, scpcurl, and lsof command  and on this article, I’ll share 5 examples of the right way to use df command successfully in Linux command line. 

5 df command usages each Programmer ought to study

With out losing anymore of your time, listed below are frequent df command choices and examples which I believer not simply programmers and builders but additionally each Linux consumer ought to study. It is one of many important Linux instructions and realizing these utilization shall be fairly helpful in long term. 
10 Examples of df command in Linux

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. 

5 df command usages every Programmer should learn

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

how to find size of all patriations Example

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

How to find size of a particular partition in Linux? Example

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

10 Examples of df command in Linux

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.

Different Linux  command articles you might like

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.



RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments