0% found this document useful (0 votes)
16 views7 pages

DF (Disk Free)

The document provides an overview of the 'df' command in Linux, which displays information about disk space usage on file systems. It includes syntax, examples of usage with various options, and explanations of the command's output. Additionally, it lists options such as '-a' for all file systems, '-h' for human-readable sizes, and '-T' for displaying file types.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views7 pages

DF (Disk Free)

The document provides an overview of the 'df' command in Linux, which displays information about disk space usage on file systems. It includes syntax, examples of usage with various options, and explanations of the command's output. Additionally, it lists options such as '-a' for all file systems, '-h' for human-readable sizes, and '-T' for displaying file types.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

7/24/2021 df command in Linux with Examples - GeeksforGeeks

Related Articles

df command in Linux with Examples


Difficulty Level : Easy ● Last Updated : 21 Feb, 2018

The df command (shor t for disk free), is used to display information related to file

systems about total space and available space.

Syntax :

df [OPTION]... [FILE]...

If no file name is given, it displays the space available on all currently mounted file

systems.

For example :

df

Output :

Filesystem 1K-blocks Used Available Use% Mounted on


udev 3996816 0 3996816 0% /dev
tmpfs 804624 10020 794604 2% /run
/dev/sda9 68117056 18036160 46597712 28% /
tmpfs 4023116 29848 3993268 1% /dev/shm
tmpfs 5120 4 5116 1% /run/lock
tmpfs 4023116 0 4023116 0% /sys/fs/cgroup
/dev/loop0 88832 88832 0 100% /snap/simplescreenrecorder/1
/dev/loop2 85888 85888 0 100% /snap/core/3748
/dev/loop3 85888 85888 0 100% /snap/core/3604
/dev/loop1 83328 83328 0 100% /snap/core/3887
We/dev/sda10
use cookies to ensure you78873504
have the best67530504 7313356
browsing experience 91%By/home
on our website. using our Got It !
site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy

https://www.geeksforgeeks.org/df-command-linux-examples/ 1/7
7/24/2021 df command in Linux with Examples - GeeksforGeeks

/dev/sda1 507904 30908 476996 7% /boot/efi


tmpfs 804624 12 804612 1% /run/user/121
tmpfs 804624 64 804560 1% /run/user/1000

Now, if you specif y par ticular file, then it will show mount information of that par ticular

file.

For example:

df /home/mandeep/test/test.cpp

Output :

Filesystem 1K-blocks Used Available Use% Mounted on


/dev/sda10 78873504 67528220 7315640 91% /home

Options for df command :

-a, –all : includes pseudo, duplicate and inaccessible file systems.

-B, –block-size=SIZE : scales sizes by SIZE before printing them.

-h, –human-readable : print sizes in power of 1024

-H, –si: print sizes in power of 1000

-i, –inodes : list inode information instead of block usage

-l, –local : limit listing to local file systems

-P, –por tability : use POSIX output format

–sync : invoke sync before getting usage info

–total : elide all entries insignificant to available space, and produce grand total

-t, –type=T YPE : limit listing to file systems of type T YPE

-T, –print-type : print file system type

df usage Examples with options :

1. If you want to display all the file system, use -a option.

We use cookies to ensure you have the best browsing experience on our website. By using our Got It !
dfacknowledge
site, you -a that you have read and understood our Cookie Policy & Privacy Policy

https://www.geeksforgeeks.org/df-command-linux-examples/ 2/7
7/24/2021 df command in Linux with Examples - GeeksforGeeks

Output :

/dev/sda10 78873504 67528540 7315320 91% /home


/dev/sda1 507904 30908 476996 7% /boot/efi
tmpfs 804624 12 804612 1% /run/user/121
tmpfs 804624 64 804560 1% /run/user/1000
gvfsd-fuse 0 0 0 - /run/user/1000/gvfs

The above is not complete output, but you can see that the information shown is

extended to info provided by df command.

2. Use -h option to display size in power of 1024

df -h /home/mandeep

Output :

Filesystem Size Used Avail Use% Mounted on


/dev/sda10 76G 65G 7.0G 91% /home

3. Use -H option to display sizes in power of 1000

df -H /home/mandeep

Output :

Filesystem Size Used Avail Use% Mounted on


/dev/sda10 81G 70G 7.5G 91% /home

You can obser ve the size section of two command with -h and -H option for difference.

4. To get complete grand total, use –total option

df --total

Output :

Filesystem 1K-blocks Used Available Use% Mounted on


udev 3996816 0 3996816 0% /dev
tmpfs 804624 10072 794552 2% /run
/dev/sda9 68117056 18036336 46597536 28% /
We usetmpfs
cookies to ensure you have4023116
the best browsing50140 3972976
experience on our website. By2% /dev/shm
using our Got It !
site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
tmpfs 5120 4 5116 1% /run/lock
https://www.geeksforgeeks.org/df-command-linux-examples/ 3/7
7/24/2021 df command in Linux with Examples - GeeksforGeeks

tmpfs 4023116 0 4023116 0% /sys/fs/cgroup


/dev/loop0 88832 88832 0 100% /snap/simplescreenrecorde
/dev/loop2 85888 85888 0 100% /snap/core/3748
/dev/loop3 85888 85888 0 100% /snap/core/3604
/dev/loop1 83328 83328 0 100% /snap/core/3887
/dev/sda10 78873504 67529320 7314540 91% /home
/dev/sda1 507904 30908 476996 7% /boot/efi
tmpfs 804624 12 804612 1% /run/user/121
tmpfs 804624 64 804560 1% /run/user/1000
total 162304440 86000792 68790820 56% -

Obser ve the last row of above table output, it specifies grand total.

5. Use -T option to display file type

For example:

df -T /home/mandeep

Output :

Filesystem Type 1K-blocks Used Available Use% Mounted on


/dev/sda10 ext4 78873504 67528128 7315732 91% /home

You can see the file type for /home/mandeep is ext4.

6. And for more help, you can use –help option.

df --help

– Mandeep Singh

References :

1) df wiki

2) Linux man page for df

Like 0

We use cookies to ensure you have the best browsing experience on our website. By using our Got It !
site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy

https://www.geeksforgeeks.org/df-command-linux-examples/ 4/7
7/24/2021 df command in Linux with Examples - GeeksforGeeks

Previous Next

ADVERTISEMENT BY ADRECOVER

RECOMMENDED ARTICLES Page : 1 2 3

'IPCS' command in Linux with SORT command in Linux/Unix with


01 05
examples examples
21, Jun 17 29, Aug 17

select command in Linux with Cat command in Linux with


02 06
examples examples
09, Jan 19 14, Sep 17

Sed Command in Linux/Unix with Head command in Linux with


03 07
examples examples
21, Aug 17 19, Sep 17

ZIP command in Linux with Tail command in Linux with


04 08
examples examples
29, Aug 17 21, Sep 17

We use cookies to ensure you have the best browsing experience on our website. By using our Got It !
site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy

https://www.geeksforgeeks.org/df-command-linux-examples/ 5/7
7/24/2021 df command in Linux with Examples - GeeksforGeeks

Ar ticle Contributed By :

msdeep14
@msdeep14

Vote for difficulty

Current difficulty : Easy

Easy Normal Medium Hard Expert

Article Tags : linux-command, Linux-Unix

Improve Article Report Issue

Writing code in comment? Please use ide.geeksforgeeks.org, generate link and share the link here.

Load Comments

ADVERTISEMENT BY ADRECOVER

5th Floor, A-118,


Sector-136, Noida, Uttar Pradesh - 201305
[email protected]
We use cookies to ensure you have the best browsing experience on our website. By using our Got It !
site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy

https://www.geeksforgeeks.org/df-command-linux-examples/ 6/7
7/24/2021 df command in Linux with Examples - GeeksforGeeks

Company Learn
About Us Algorithms
Careers Data Structures
Privacy Policy Languages
Contact Us CS Subjects
Copyright Policy Video Tutorials

Practice Contribute
Courses Write an Article
Company-wise Write Interview Experience
Topic-wise Internships
How to begin? Videos

@geeksforgeeks , Some rights reserved

We use cookies to ensure you have the best browsing experience on our website. By using our Got It !
site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy

https://www.geeksforgeeks.org/df-command-linux-examples/ 7/7

You might also like