{"id":19124,"date":"2023-01-02T06:37:43","date_gmt":"2023-01-02T06:37:43","guid":{"rendered":"https:\/\/linuxways.net\/?p=19124"},"modified":"2023-01-05T15:32:06","modified_gmt":"2023-01-05T15:32:06","slug":"linux-df-vs-linux-du-commands-compared","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/centos\/linux-df-vs-linux-du-commands-compared\/","title":{"rendered":"Linux df vs Linux du commands compared"},"content":{"rendered":"<p>The commands df (Disk Free) and du (Disk Usage) are both used to get a snapshot of the disk utilization of the system. The df command provides a less accurate ballpark figure of the available disk utilization while du command is more accurate and tells you the exact figure of a given directory or subdirectory.<\/p>\n<p>But both the df vs Linux du commands are useful to get useful insight on your Linux system. And in this article we will compare Linux df vs Linux du commands, look into their main differences and see some Linux df vs Linux du commands.<\/p>\n<h2>What Is The Difference Between Du And Df Command In Linux<\/h2>\n<p>We previously mentioned that both Du And Df Command give information about the disk utilization of a Linux system. The main difference between the Du and Df command is how the information is presented to the end user. Du is a standard Unix program used to estimate file space usage (space that is used under a particular directory). While df is a common Unix command used to show how much disk space is available for file systems when the user issuing the command has authorized read access.<\/p>\n<p>Let\u2019s look at their differences in detail to find out when each of the commands should be used.<\/p>\n<h3>df command in Linux (with example)<\/h3>\n<p>If no file name is given, the Df command gives info on the space available on all currently mounted file systems. The space is given on blocks starting from 1K blocks by default unless the environment variable POSIXLY_CORRECT is set to 512-byte blocks.<\/p>\n<p>However, if a file name is provided, df shows the space available on that file system rather than on the file system containing the device node.<\/p>\n<h3>Some examples of df command include:<\/h3>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">df<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-19125 size-large\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-01-at-9.27.07-pm-1024x669.png\" alt=\"\" width=\"1020\" height=\"666\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-01-at-9.27.07-pm-1024x669.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-01-at-9.27.07-pm-300x196.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-01-at-9.27.07-pm-768x502.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-01-at-9.27.07-pm.png 1476w\" sizes=\"auto, (max-width: 1020px) 100vw, 1020px\" \/><\/p>\n<p>The simplest df command without any command parameters is used to display information about the file system disk space usage. It also shows the device name, total blocks, total disk space, used disk space, free disk space and other useful information.<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">df<\/span> <span class=\"re5\">-a<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-19126 size-large\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-02-at-12.05.45-pm-1024x671.png\" alt=\"\" width=\"1020\" height=\"668\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-02-at-12.05.45-pm-1024x671.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-02-at-12.05.45-pm-300x196.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-02-at-12.05.45-pm-768x503.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-02-at-12.05.45-pm.png 1472w\" sizes=\"auto, (max-width: 1020px) 100vw, 1020px\" \/><\/p>\n<p>Using the df command with -a or \u2013all is used to show dummy file systems information along with all the basic file system disk usage information.<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">df<\/span> <span class=\"re5\">-h<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-19127 size-large\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-02-at-12.14.39-pm-1024x664.png\" alt=\"\" width=\"1020\" height=\"661\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-02-at-12.14.39-pm-1024x664.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-02-at-12.14.39-pm-300x194.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-02-at-12.14.39-pm-768x498.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-02-at-12.14.39-pm.png 1472w\" sizes=\"auto, (max-width: 1020px) 100vw, 1020px\" \/><\/p>\n<p>The disk utilization information are presented in 1K blocks by default which can be a bit challenging to understand. So, to make things a bit user-friendly you can use the \u201c-h\u201d command parameter to show the file system disk space usage data in \u201chuman readable\u201d format.<\/p>\n<h3>du command in Linux (with example)<\/h3>\n<p>Df is another common Unix command which is used to show how much disk space is available for file systems when the user issuing the command has authorized read access. A common Unix tool called du is used to calculate the amount of disk space consumed by a certain directory or set of files on a file system. Each FILE and\/or directory&#8217;s disk space use is tallied by the du tool. Printing of disk space is done in 1024-byte increments.<\/p>\n<h3>Some examples of df command include:<\/h3>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">df<\/span> <span class=\"re5\">-k<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-19128 size-large\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-02-at-12.15.08-pm-1024x663.png\" alt=\"\" width=\"1020\" height=\"660\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-02-at-12.15.08-pm-1024x663.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-02-at-12.15.08-pm-300x194.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-02-at-12.15.08-pm-768x497.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-02-at-12.15.08-pm.png 1474w\" sizes=\"auto, (max-width: 1020px) 100vw, 1020px\" \/><\/p>\n<p><span style=\"font-weight: 400\">The most basic command which is used to display all file system information in 1024-byte blocks.<\/span><\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">df<\/span> <span class=\"re5\">-m<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-19129 size-large\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-02-at-12.15.33-pm-1024x665.png\" alt=\"\" width=\"1020\" height=\"662\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-02-at-12.15.33-pm-1024x665.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-02-at-12.15.33-pm-300x195.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-02-at-12.15.33-pm-768x498.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-02-at-12.15.33-pm.png 1470w\" sizes=\"auto, (max-width: 1020px) 100vw, 1020px\" \/><\/p>\n<p>If you do not want to see the file size in a kilobyte and prefer the more standardized Megabyte, you can use the command argument -m to display the file information in MB (Mega Byte). You can also use the attribute -h to see the info in GB (Gigabyte).<\/p>","protected":false},"excerpt":{"rendered":"<p>The commands df (Disk Free) and du (Disk Usage) are both used to get a snapshot of the disk utilization of the system. The df command provides a&hellip;<\/p>","protected":false},"author":107,"featured_media":19130,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,2],"tags":[],"class_list":["post-19124","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","category-ubuntu"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/19124","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/107"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=19124"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/19124\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/19130"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=19124"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=19124"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=19124"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}