Robert Elder Software Inc.
  • Home
  • Store
  • Blog
  • Contact
  • Home
  • Store
  • Blog
  • Contact
  • #linux
  • |
  • #commandline
  • |
  • #softwareengineering
  • |
  • #embeddedsystems
  • |
  • #compilers
  • ...
  • View All >>

Intro To 'df' Command In Linux

2023-05-16 - By Robert Elder

     I use the 'df' command to show how much disk space my file systems are using:

df
Filesystem      1K-blocks      Used Available Use% Mounted on
udev              7979828         0   7979828   0% /dev
tmpfs             1603624      2756   1600868   1% /run
/dev/nvme0n1p3   95535524  73493788  17142564  82% /
tmpfs             8018116     74416   7943700   1% /dev/shm
tmpfs                5120         4      5116   1% /run/lock
tmpfs             8018116         0   8018116   0% /sys/fs/cgroup
/dev/loop0          12288     12288         0 100% /snap/arduino-cli/35
/dev/loop1          12288     12288         0 100% /snap/arduino-cli/37
/dev/loop3         168832    168832         0 100% /snap/gnome-3-28-1804/194
/dev/loop2          56960     56960         0 100% /snap/core18/2721
/dev/loop5          64896     64896         0 100% /snap/core20/1879
/dev/loop4            128       128         0 100% /snap/bare/5
/dev/loop6          56448     56448         0 100% /snap/cups/872
/dev/loop11        153856    153856         0 100% /snap/chromium/2465
/dev/loop8         168832    168832         0 100% /snap/gnome-3-28-1804/198
/dev/loop7          74880     74880         0 100% /snap/core22/634
/dev/loop9          74752     74752         0 100% /snap/core22/617
/dev/loop10        152704    152704         0 100% /snap/chromium/2424
/dev/loop13         56448     56448         0 100% /snap/cups/836
/dev/loop12         64896     64896         0 100% /snap/core20/1852
/dev/loop15        210432    210432         0 100% /snap/rpi-imager/351
/dev/loop16         54528     54528         0 100% /snap/snapd/18933
/dev/loop14         57088     57088         0 100% /snap/core18/2745
/dev/loop19         93952     93952         0 100% /snap/gtk-common-themes/1535
/dev/loop24        471680    471680         0 100% /snap/gnome-42-2204/99
/dev/loop17        471680    471680         0 100% /snap/gnome-42-2204/102
/dev/loop18         54528     54528         0 100% /snap/snapd/19122
/dev/loop23         12672     12672         0 100% /snap/snap-store/959
/dev/loop28        223744    223744         0 100% /snap/gnome-3-34-1804/90
/dev/loop20        358144    358144         0 100% /snap/gnome-3-38-2004/137
/dev/loop22        358144    358144         0 100% /snap/gnome-3-38-2004/140
/dev/loop26         47104     47104         0 100% /snap/snap-store/638
/dev/loop27        210432    210432         0 100% /snap/rpi-imager/371
/dev/loop25         83328     83328         0 100% /snap/gtk-common-themes/1534
/dev/loop21        223744    223744         0 100% /snap/gnome-3-34-1804/93
/dev/nvme0n1p1     997456     32972    964484   4% /boot/efi
/dev/sda1      1921723652 936928268 887103376  52% /video
/dev/nvme0n1p4  390093876  37763936 332440996  11% /mnt
tmpfs             1603620        52   1603568   1% /run/user/1000

     In the output above, you can see a listing of all of my file systems.  Many of these file systems such as 'loop' or 'tmpfs' are used for system purposes.

     I can use the '-h' flag to improve the readability of the numbers in the output.

df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            7.7G     0  7.7G   0% /dev
tmpfs           1.6G  2.7M  1.6G   1% /run
/dev/nvme0n1p3   92G   71G   17G  82% /
tmpfs           7.7G   48M  7.7G   1% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           7.7G     0  7.7G   0% /sys/fs/cgroup
/dev/loop0       12M   12M     0 100% /snap/arduino-cli/35
/dev/loop1       12M   12M     0 100% /snap/arduino-cli/37
/dev/loop3      165M  165M     0 100% /snap/gnome-3-28-1804/194
/dev/loop2       56M   56M     0 100% /snap/core18/2721
/dev/loop5       64M   64M     0 100% /snap/core20/1879
/dev/loop4      128K  128K     0 100% /snap/bare/5
/dev/loop6       56M   56M     0 100% /snap/cups/872
/dev/loop11     151M  151M     0 100% /snap/chromium/2465
/dev/loop8      165M  165M     0 100% /snap/gnome-3-28-1804/198
/dev/loop7       74M   74M     0 100% /snap/core22/634
/dev/loop9       73M   73M     0 100% /snap/core22/617
/dev/loop10     150M  150M     0 100% /snap/chromium/2424
/dev/loop13      56M   56M     0 100% /snap/cups/836
/dev/loop12      64M   64M     0 100% /snap/core20/1852
/dev/loop15     206M  206M     0 100% /snap/rpi-imager/351
/dev/loop16      54M   54M     0 100% /snap/snapd/18933
/dev/loop14      56M   56M     0 100% /snap/core18/2745
/dev/loop19      92M   92M     0 100% /snap/gtk-common-themes/1535
/dev/loop24     461M  461M     0 100% /snap/gnome-42-2204/99
/dev/loop17     461M  461M     0 100% /snap/gnome-42-2204/102
/dev/loop18      54M   54M     0 100% /snap/snapd/19122
/dev/loop23      13M   13M     0 100% /snap/snap-store/959
/dev/loop28     219M  219M     0 100% /snap/gnome-3-34-1804/90
/dev/loop20     350M  350M     0 100% /snap/gnome-3-38-2004/137
/dev/loop22     350M  350M     0 100% /snap/gnome-3-38-2004/140
/dev/loop26      46M   46M     0 100% /snap/snap-store/638
/dev/loop27     206M  206M     0 100% /snap/rpi-imager/371
/dev/loop25      82M   82M     0 100% /snap/gtk-common-themes/1534
/dev/loop21     219M  219M     0 100% /snap/gnome-3-34-1804/93
/dev/nvme0n1p1  975M   33M  942M   4% /boot/efi
/dev/sda1       1.8T  894G  847G  52% /video
/dev/nvme0n1p4  373G   37G  318G  11% /mnt
tmpfs           1.6G   48K  1.6G   1% /run/user/1000

     I can also provide a list of partitions to see usage information for only those file systems:

df -h /dev/sda1 /dev/sda5 /dev/sdc1
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       511M  4.0K  511M   1% /boot/efi
/dev/sda5       117G   45G   67G  41% /
/dev/sdc1       916G  106G  765G  13% /test-partition

     In the output above, I can see that I'm currently using 106 gigs of the available 916 gigs, or 13% on the 'test-partition'.

     If I include the '-i' flag, I'll see information about inode usage instead:

df -hi /dev/sda1 /dev/sda5 /dev/sdc1
Filesystem     Inodes IUsed IFree IUse% Mounted on
/dev/sda1           0     0     0     - /boot/efi
/dev/sda5        7.5M  268K  7.2M    4% /
/dev/sdc1         59M   27M   33M   45% /test-partition

     In the output above, I can see that I've used up 45% of the available inodes on the 'test-partition'.

     And that's why the 'df' command is my favourite Linux command.

Intro To 'stty' Command In Linux
Intro To 'stty' Command In Linux
Published 2023-10-04
Terminal Block Mining Simulation Game
$1.00 CAD
Terminal Block Mining Simulation Game
Intro To 'nproc' Command In Linux
Intro To 'nproc' Command In Linux
Published 2023-07-15
Intro To 'comm' Command In Linux
Intro To 'comm' Command In Linux
Published 2023-09-06
How To Force The 'true' Command To Return 'false'
How To Force The 'true' Command To Return 'false'
Published 2023-07-09
A Surprisingly Common Mistake Involving Wildcards & The Find Command
A Surprisingly Common Mistake Involving Wildcards & The Find Command
Published 2020-01-21
A Guide to Recording 660FPS Video On A $6 Raspberry Pi Camera
A Guide to Recording 660FPS Video On A $6 Raspberry Pi Camera
Published 2019-08-01
Intro To 'chroot' Command In Linux
Intro To 'chroot' Command In Linux
Published 2023-06-23
Join My Mailing List
Privacy Policy
Why Bother Subscribing?
  • Free Software/Engineering Content. I publish all of my educational content publicly for free so everybody can make use of it.  Why bother signing up for a paid 'course', when you can just sign up for this email list?
  • Read about cool new products that I'm building. How do I make money? Glad you asked!  You'll get some emails with examples of things that I sell.  You might even get some business ideas of your own :)
  • People actually like this email list. I know that sounds crazy, because who actually subscribes to email lists these days, right?  Well, some do, and if you end up not liking it, I give you permission to unsubscribe and mark it as spam.
© 2025 Robert Elder Software Inc.
SocialSocialSocialSocialSocialSocialSocial
Privacy Policy      Store Policies      Terms of Use