{"id":81,"date":"2021-10-02T13:39:00","date_gmt":"2021-10-02T13:39:00","guid":{"rendered":"https:\/\/bestdedicatedhosting.in\/blog\/?p=81"},"modified":"2021-11-02T13:10:39","modified_gmt":"2021-11-02T13:10:39","slug":"useful-du-commands-to-check-the-disk-usage","status":"publish","type":"post","link":"https:\/\/bestdedicatedhosting.in\/blog\/useful-du-commands-to-check-the-disk-usage\/","title":{"rendered":"Useful du commands to check the disk usage"},"content":{"rendered":"\n<p>The Linux \u201cdu\u201d (Disk Usage) is a standard Unix\/Linux command, used to check the information of disk usage of files and directories on a machine. <\/p>\n\n\n\n<p>The du command has many parameter options that can be used to get the results in many formats. <\/p>\n\n\n\n<p>The du command also displays the files and directory sizes in a recursively manner.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Here, we will discuss about the 7 useful du commands<\/p>\n\n\n\n<p>1. To find out the disk usage summary of a \/home\/directoryname directory tree and each of its sub directories. Enter the command as:<\/p>\n\n\n\n<p><strong><code>du \/home\/directoryname<\/code><\/strong><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>2. Using \u201c-h\u201d option with \u201cdu\u201d command provides results in \u201cHuman Readable Format\u201c. Means you can see sizes in Bytes, Kilobytes, Megabytes, Gigabytes etc.<\/p>\n\n\n\n<p><strong>d<code>u -h \/directoryname<\/code><\/strong><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>3. To get the summary of a grand total disk usage size of an directory use the option \u201c-s\u201d as follows.<\/p>\n\n\n\n<p><strong><code>du -sh \/directoryname<\/code><\/strong><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>4. Using \u201c-a\u201d flag with \u201cdu\u201d command displays the disk usage of all the files and directories.<\/p>\n\n\n\n<p><strong><code>du -a \/directoryname<\/code><\/strong><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>5. Using \u201c-a\u201d flag along with \u201c-h\u201d displays disk usage of all files and folders in human readeable format.<\/p>\n\n\n\n<p><strong><code>du -ah \/directoryname<\/code><\/strong><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>6. To get the summary of disk usage of directory tree along with its subtrees in Megabytes (MB) only by using this option \u201c-mh\u201d<\/p>\n\n\n\n<p><strong><code>du -mh \/directoryname<\/code><\/strong><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>7. The \u201c-c\u201d flag provides a grand total usage disk space at the last line<\/p>\n\n\n\n<p><strong><code>du -c \/directoryname<\/code><\/strong><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>We hope you\u2019ve found this useful!<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Linux \u201cdu\u201d (Disk Usage) is a standard Unix\/Linux command, used to check the information of disk usage of files and directories on a machine. The du command has many parameter options that can be used to get the results in many formats. The du command also displays the files and directory sizes in a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_eb_attr":"","footnotes":""},"categories":[4],"tags":[],"class_list":["post-81","post","type-post","status-publish","format-standard","hentry","category-linux"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/bestdedicatedhosting.in\/blog\/wp-json\/wp\/v2\/posts\/81","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bestdedicatedhosting.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bestdedicatedhosting.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bestdedicatedhosting.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bestdedicatedhosting.in\/blog\/wp-json\/wp\/v2\/comments?post=81"}],"version-history":[{"count":3,"href":"https:\/\/bestdedicatedhosting.in\/blog\/wp-json\/wp\/v2\/posts\/81\/revisions"}],"predecessor-version":[{"id":85,"href":"https:\/\/bestdedicatedhosting.in\/blog\/wp-json\/wp\/v2\/posts\/81\/revisions\/85"}],"wp:attachment":[{"href":"https:\/\/bestdedicatedhosting.in\/blog\/wp-json\/wp\/v2\/media?parent=81"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bestdedicatedhosting.in\/blog\/wp-json\/wp\/v2\/categories?post=81"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bestdedicatedhosting.in\/blog\/wp-json\/wp\/v2\/tags?post=81"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}