{"id":208,"date":"2016-01-12T15:33:29","date_gmt":"2016-01-12T15:33:29","guid":{"rendered":"http:\/\/wp-p3d2tsa2xh.pairsite.com\/?p=208"},"modified":"2019-02-06T13:39:32","modified_gmt":"2019-02-06T18:39:32","slug":"paircloud-du-and-df","status":"publish","type":"ht_kb","link":"https:\/\/www.pair.com\/support\/kb\/paircloud-du-and-df\/","title":{"rendered":"Using du and df"},"content":{"rendered":"<p class=\"p1\"><span class=\"s1\"><a style=\"color:#fff; text-decoration:none!important;\" href=\"https:\/\/www.pair.com\/support\/kb\/tags\/shared-hosting\/\"><p style=\"background-color:#1a3d6e !important;color:#fff;padding:6px; display:inline-block!important;font-size:12px;font-weight:bold; border-radius:3px;\">Shared<\/p><\/a> <a style=\"color:#fff; text-decoration:none!important;\" href=\"https:\/\/www.pair.com\/support\/kb\/tags\/vps\/\"><p style=\"background-color:#1a3d6e !important;color:#fff;padding:6px; display:inline-block!important;font-size:12px;font-weight:bold; border-radius:3px;\">VPS<\/p><\/a> <a style=\"color:#fff; text-decoration:none!important;\" href=\"https:\/\/www.pair.com\/support\/kb\/tags\/qs-dedicated\/\"><p style=\"background-color:#1a3d6e !important;color:#fff;padding:6px; display:inline-block!important;font-size:12px; font-weight:bold; border-radius:3px;\">Dedicated<\/p><\/a>\u00a0<a style=\"color:#fff; text-decoration:none!important;\" href=\"https:\/\/www.pair.com\/support\/kb\/tags\/wp-professional\/\"><p style=\"background-color:#1a3d6e !important;color:#fff !important;padding:6px; display:inline-block!important;font-size:12px;font-weight:bold; border-radius:3px;\">WP Professional<\/p><\/a> <a style=\"color:#fff; text-decoration:none!important;\" href=\"https:\/\/www.pair.com\/support\/kb\/tags\/wp-professional-plus\/\"><p style=\"background-color:#1a3d6e !important;color:#fff !important;padding:6px; display:inline-block!important;font-size:12px;font-weight:bold; border-radius:3px;\">WP Professional Plus<\/p><\/a><\/span><\/p>\n<p>The <code>df<\/code> and <code>du<\/code> commands are two small utilities that are extremely useful. The <code>df<\/code> command displays the disk free space and the <code>du<\/code> command displays the disk usage. There basic usage is <code>df [options]<\/code> and <code>du [options]<\/code>.<\/p>\n<h3 class=\"kb\">Using du<\/h3>\n<p>The basic usage of <code>du<\/code> is simply <code>du<\/code>. When run you will see an output like this:<\/p>\n<pre>root@ubuntu:~# du\r\n28      .\/scripts\r\n4       .\/.cache\r\n8       .\/.ssh\r\n16      .\/.aptitude\r\n108     .<\/pre>\n<p>This means that this directory is using 108Kbytes of disk space. This is actual disk space used not the size of the files. So a 1 byte file would show as using a whole unit of disk storage which on the test system this tutorial is using equals 4K.<\/p>\n<p>There are a number of useful options for <code>du<\/code>. The main ones are <code>-a<\/code>, <code>-c<\/code> and <code>-h<\/code>. The <code>-a<\/code> option shows all files as well as folders in the list. The <code>-c<\/code> option provides a total and the <code>-h<\/code> option gives the values in a human readable form. The human readable form gives the entries with the best suffix for readability. For instance instead of 86604 it will give you 85M.<\/p>\n<h3>Using df<\/h3>\n<p>Using <code>df<\/code> on its own will give you an output like this:<\/p>\n<pre>root@ubuntu:\/var\/log# df\r\nFilesystem     1K-blocks    Used Available Use% Mounted on\r\n\/dev\/vda1       20511356 1982284  17464116  11% \/\r\nnone                   4       0         4   0% \/sys\/fs\/cgroup\r\nudev              240040       8    240032   1% \/dev\r\ntmpfs              50180     348     49832   1% \/run\r\nnone                5120       0      5120   0% \/run\/lock\r\nnone              250896       0    250896   0% \/run\/shm\r\nnone              102400       0    102400   0% \/run\/user<\/pre>\n<p>The important line in this out put is <strong>\/dev\/vda1<\/strong>, as this is our main mounted filing system. You may also see <strong>\/dev\/sda1<\/strong>, <strong>\/dev\/hda1<\/strong> plus others. You can safely ignore any line that has <strong>none<\/strong> in the first column. You can also safely ignore <strong>tmpfs<\/strong> unless you are having specific problems with <strong>memory mounted temporary filing systems<\/strong>. You can also ignore <strong>udev<\/strong> unless you are specifically having mounting issues. That just leaves us with our main line of interest.<\/p>\n<pre>Filesystem     1K-blocks    Used Available Use% Mounted on\r\n\/dev\/vda1       20511356 1982284  17464116  11% \/<\/pre>\n<p>There is only one option that you will find useful in day to day uses and that is the <code>-h<\/code> option. This does the same as it does for <code>du<\/code> in that the output will be in human readable units. If you execute <code>df -h<\/code> on the same system you will see this.<\/p>\n<pre>Filesystem      Size  Used Avail Use% Mounted on\r\n\/dev\/vda1        20G  1.9G   17G  11% \/<\/pre>\n<p>So rather than <code>20511356 1982284  17464116<\/code> you get <code>20G  1.9G   17G<\/code> which is much more useful at first glance.<\/p>\n<h3 class=\"kb\">Useful tricks<\/h3>\n<p>If you are using <code>df<\/code> and <code>du<\/code>, it is likely that you have a file system issue and the most common one will be a partition being full and you want to track down where\u2026.<\/p>\n<p>This command will come in handy.<\/p>\n<p><code>du -Sh | sort -rh | head -n 5 <\/code><\/p>\n<p>What this does is pipe the output from <code>du<\/code> with the human readable option and the ignore subdirectory option to <code>sort<\/code>. The <code>sort<\/code> command will then sort the lines by size (human readable) and reverse the list. The output of this is then sent to <code>head<\/code> which will just give you the first <code>-n<\/code> lines. In this case it is 5 lines. This will give you the top 5 folders by size in the current directory. You can then <code>cd<\/code> into a directory and run it again\u2026<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0 The df and du commands are two small utilities that are extremely useful. The df command displays the disk free space and the du command displays the disk usage. There basic usage is df [options] and du [options]. Using du The basic usage of du is simply du. When&#8230;<\/p>\n","protected":false},"author":12,"comment_status":"closed","ping_status":"open","template":"","format":"standard","meta":[],"ht-kb-category":[13],"ht-kb-tag":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.8.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Using du and df - Knowledge Base - Pair Networks<\/title>\n<meta name=\"description\" content=\"in the command line, you can use the df command to display the disk free space and the du command to display the disk usage.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pair.com\/support\/kb\/paircloud-du-and-df\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using du and df - Knowledge Base - Pair Networks\" \/>\n<meta property=\"og:description\" content=\"in the command line, you can use the df command to display the disk free space and the du command to display the disk usage.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pair.com\/support\/kb\/paircloud-du-and-df\/\" \/>\n<meta property=\"og:site_name\" content=\"Knowledge Base - Pair Networks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/pairnetworks\/\" \/>\n<meta property=\"article:modified_time\" content=\"2019-02-06T18:39:32+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@pairNetworks\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.pair.com\/support\/kb\/paircloud-du-and-df\/\",\"url\":\"https:\/\/www.pair.com\/support\/kb\/paircloud-du-and-df\/\",\"name\":\"Using du and df - Knowledge Base - Pair Networks\",\"isPartOf\":{\"@id\":\"https:\/\/www.pair.com\/support\/kb\/#website\"},\"datePublished\":\"2016-01-12T15:33:29+00:00\",\"dateModified\":\"2019-02-06T18:39:32+00:00\",\"description\":\"in the command line, you can use the df command to display the disk free space and the du command to display the disk usage.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.pair.com\/support\/kb\/paircloud-du-and-df\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.pair.com\/support\/kb\/paircloud-du-and-df\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.pair.com\/support\/kb\/paircloud-du-and-df\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.pair.com\/support\/kb\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Using du and df\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.pair.com\/support\/kb\/#website\",\"url\":\"https:\/\/www.pair.com\/support\/kb\/\",\"name\":\"Knowledge Base - Pair Networks\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.pair.com\/support\/kb\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.pair.com\/support\/kb\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.pair.com\/support\/kb\/#organization\",\"name\":\"Pair Networks\",\"url\":\"https:\/\/www.pair.com\/support\/kb\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pair.com\/support\/kb\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2022\/02\/Gb_TUkUE_400x400.jpeg\",\"contentUrl\":\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2022\/02\/Gb_TUkUE_400x400.jpeg\",\"width\":360,\"height\":360,\"caption\":\"Pair Networks\"},\"image\":{\"@id\":\"https:\/\/www.pair.com\/support\/kb\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/pairnetworks\/\",\"https:\/\/twitter.com\/pairNetworks\",\"https:\/\/www.instagram.com\/pairnetworks\/\",\"https:\/\/www.linkedin.com\/company\/2269676\/\",\"https:\/\/www.pinterest.com\/pairnetworksinc\/pins\/\",\"https:\/\/www.youtube.com\/user\/pairnetworks\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Using du and df - Knowledge Base - Pair Networks","description":"in the command line, you can use the df command to display the disk free space and the du command to display the disk usage.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.pair.com\/support\/kb\/paircloud-du-and-df\/","og_locale":"en_US","og_type":"article","og_title":"Using du and df - Knowledge Base - Pair Networks","og_description":"in the command line, you can use the df command to display the disk free space and the du command to display the disk usage.","og_url":"https:\/\/www.pair.com\/support\/kb\/paircloud-du-and-df\/","og_site_name":"Knowledge Base - Pair Networks","article_publisher":"https:\/\/www.facebook.com\/pairnetworks\/","article_modified_time":"2019-02-06T18:39:32+00:00","twitter_card":"summary_large_image","twitter_site":"@pairNetworks","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.pair.com\/support\/kb\/paircloud-du-and-df\/","url":"https:\/\/www.pair.com\/support\/kb\/paircloud-du-and-df\/","name":"Using du and df - Knowledge Base - Pair Networks","isPartOf":{"@id":"https:\/\/www.pair.com\/support\/kb\/#website"},"datePublished":"2016-01-12T15:33:29+00:00","dateModified":"2019-02-06T18:39:32+00:00","description":"in the command line, you can use the df command to display the disk free space and the du command to display the disk usage.","breadcrumb":{"@id":"https:\/\/www.pair.com\/support\/kb\/paircloud-du-and-df\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pair.com\/support\/kb\/paircloud-du-and-df\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.pair.com\/support\/kb\/paircloud-du-and-df\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pair.com\/support\/kb\/"},{"@type":"ListItem","position":2,"name":"Using du and df"}]},{"@type":"WebSite","@id":"https:\/\/www.pair.com\/support\/kb\/#website","url":"https:\/\/www.pair.com\/support\/kb\/","name":"Knowledge Base - Pair Networks","description":"","publisher":{"@id":"https:\/\/www.pair.com\/support\/kb\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pair.com\/support\/kb\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.pair.com\/support\/kb\/#organization","name":"Pair Networks","url":"https:\/\/www.pair.com\/support\/kb\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pair.com\/support\/kb\/#\/schema\/logo\/image\/","url":"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2022\/02\/Gb_TUkUE_400x400.jpeg","contentUrl":"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2022\/02\/Gb_TUkUE_400x400.jpeg","width":360,"height":360,"caption":"Pair Networks"},"image":{"@id":"https:\/\/www.pair.com\/support\/kb\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/pairnetworks\/","https:\/\/twitter.com\/pairNetworks","https:\/\/www.instagram.com\/pairnetworks\/","https:\/\/www.linkedin.com\/company\/2269676\/","https:\/\/www.pinterest.com\/pairnetworksinc\/pins\/","https:\/\/www.youtube.com\/user\/pairnetworks"]}]}},"_links":{"self":[{"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/ht-kb\/208"}],"collection":[{"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/comments?post=208"}],"version-history":[{"count":4,"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/ht-kb\/208\/revisions"}],"predecessor-version":[{"id":6563,"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/ht-kb\/208\/revisions\/6563"}],"wp:attachment":[{"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/media?parent=208"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/ht-kb-category?post=208"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/ht-kb-tag?post=208"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}