{"id":5883,"date":"2021-04-22T16:18:32","date_gmt":"2021-04-22T16:18:32","guid":{"rendered":"https:\/\/linuxways.net\/?p=5883"},"modified":"2021-04-22T16:18:32","modified_gmt":"2021-04-22T16:18:32","slug":"check-disk-usage-using-duf-command-line-utility","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/centos\/check-disk-usage-using-duf-command-line-utility\/","title":{"rendered":"Check Disk Usage Using Duf Command-line Utility"},"content":{"rendered":"<p>The good old df command sure does a decent job in keeping tabs on the disk space usage. That\u2019s not in doubt. However, a new tool in the open-source community has come to revolutionize the way we view disk space usage statistics on the terminal.<a href=\"https:\/\/github.com\/muesli\/duf\"> DUF<\/a>, an acronym for Disk Usage Free utility, is a free and awesome command-line tool that prints disk usage statistics in an intuitive and fancy format on the terminal. DUF is developed in the Go programming language and is a cross-platform tool that can be installed in Windows, Linux, BSD ad macOS.<\/p>\n<p>In this tutorial, we showcase how to install DUF and use it to print various disk usage metrics.<\/p>\n<h2><strong>Prerequisites<\/strong><\/h2>\n<p>Before you get started, ensure you have a Linux distribution with a sudo user configured. We have used Ubuntu 20.04 LTS. Additionally, confirm that you have a fast and reliable internet connection that will be required for the installation of packages.<\/p>\n<h2><strong>How to install DUF on Linux<\/strong><\/h2>\n<p>There are 3 approaches to installing the DUF utility tool and we shall begin with the easiest.<\/p>\n<h2><strong>Install DUF using snap packages<\/strong><\/h2>\n<p>The easiest and most straightforward way of installing DUF is using snap packages. But before you go a step further, ensure that snap is enabled. Here\u2019s a comprehensive guide on<a href=\"https:\/\/snapcraft.io\/duf-utility\"> how to enable snap for various Linux flavors<\/a>. Once snap is enabled, invoke the following command as the sudo user.<\/p>\n<pre><strong>$ sudo snap install duf-utility<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"748\" height=\"179\" class=\"wp-image-5884\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-216.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-216.png 748w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-216-300x72.png 300w\" sizes=\"auto, (max-width: 748px) 100vw, 748px\" \/><\/strong><\/p>\n<p>Once installed, you will be notified that DUF has successfully been installed. To confirm the version of DUF installed, run:<\/p>\n<pre><strong>$ duf --version <\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"742\" height=\"234\" class=\"wp-image-5885\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-217.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-217.png 742w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-217-300x95.png 300w\" sizes=\"auto, (max-width: 742px) 100vw, 742px\" \/><\/strong><\/p>\n<h2><strong>Install DUF from .deb or .rpm packages<\/strong><\/h2>\n<p>DUF Linux packages are also available in both .deb and .rpm packages. To get more insights on the available duf packages and the supported architectures, visit the <a href=\"https:\/\/github.com\/muesli\/duf\/releases\">GitHub releases page<\/a>.<\/p>\n<p>On Debian \/ Ubuntu distributions, download the .deb file as follows. I\u2019m using Ubuntu 20.04 which is a 64-bit system, and so I\u2019ll grab the 64-bit Debian package as follows:<\/p>\n<pre><strong>$ wget https:\/\/github.com\/muesli\/duf\/releases\/download\/v0.6.2\/duf_0.6.2_linux_amd64.deb<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"742\" height=\"186\" class=\"wp-image-5886\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-218.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-218.png 742w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-218-300x75.png 300w\" sizes=\"auto, (max-width: 742px) 100vw, 742px\" \/><\/p>\n<p>Once the DUF package is downloaded, run it as shown:<\/p>\n<pre><strong>$ sudo dpkg -i duf_0.6.2_linux_amd64.deb<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"740\" height=\"272\" class=\"wp-image-5887\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-219.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-219.png 740w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-219-300x110.png 300w\" sizes=\"auto, (max-width: 740px) 100vw, 740px\" \/><\/p>\n<h2><strong>Install DUF from source<\/strong><\/h2>\n<p>Lastly, you can compile DUF from source. But as we pointed out earlier, DUF is written in GO language. So before compiling from source, ensure that you <a href=\"https:\/\/linuxways.net\/de\/ubuntu\/how-to-install-go-on-ubuntu-20-04\/\">install GO programming language <\/a>as a prerequisite.<\/p>\n<p>Once installed, proceed and clone the git repo.<\/p>\n<pre><strong>$ git clone https:\/\/github.com\/muesli\/duf.git<\/strong><\/pre>\n<p>Navigate into the clone directory.<\/p>\n<pre><strong>$ cd duf<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"737\" height=\"305\" class=\"wp-image-5888\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-220.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-220.png 737w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-220-300x124.png 300w\" sizes=\"auto, (max-width: 737px) 100vw, 737px\" \/><\/p>\n<p>And finally, compile the source code as indicated.<\/p>\n<pre><strong>$ go build<\/strong><\/pre>\n<h2><strong>Using DUF to check disk usage<\/strong><\/h2>\n<p>To begin monitoring disk space usage, simply invoke the duf command as follows:<\/p>\n<pre><strong>$ duf<\/strong><\/pre>\n<p>This prints out the disk usage statistics in a color-coded format in a tabular format.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"912\" height=\"616\" class=\"wp-image-5889\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-221.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-221.png 912w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-221-300x203.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-221-768x519.png 768w\" sizes=\"auto, (max-width: 912px) 100vw, 912px\" \/><\/p>\n<p>Instead of displaying all the mount points, you can set duf t. For example, to display disk usage on the root partition only ( <strong>\/<\/strong> ) run the command:<\/p>\n<pre><strong>$ duf \/<\/strong><\/pre>\n<p>To display disk usage on the home partition invoke:<\/p>\n<pre><strong>$ duf \/home<\/strong><\/pre>\n<p>Additionally, you can list the partitions on a single command as follows. This prints out the disk usage statistics on the three partitions indicated.<\/p>\n<pre><strong>$ duf \/ \/ boot \/home<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"909\" height=\"633\" class=\"wp-image-5890\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-222.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-222.png 909w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-222-300x209.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-222-768x535.png 768w\" sizes=\"auto, (max-width: 909px) 100vw, 909px\" \/><\/p>\n<p>Also, you can filter the columns that you want to display. For instance, if you want to display the \u2018Mounted ON\u2019 , SIZE, USED, AVAILABLE SPACE, and FILESYSTEM TYPE, run the command:<\/p>\n<pre><strong>$ duf --output mountpoint,size,used,avail,type \/home<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"913\" height=\"249\" class=\"wp-image-5891\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-223.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-223.png 913w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-223-300x82.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-223-768x209.png 768w\" sizes=\"auto, (max-width: 913px) 100vw, 913px\" \/><\/p>\n<p>Moreover, you can choose to view the inodes as follows:<\/p>\n<pre><strong>$ duf --inodes<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"911\" height=\"504\" class=\"wp-image-5892\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-224.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-224.png 911w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-224-300x166.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-224-768x425.png 768w\" sizes=\"auto, (max-width: 911px) 100vw, 911px\" \/><\/p>\n<p>To print the output in JSON, run:<\/p>\n<pre><strong>$ duf --json<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"741\" height=\"490\" class=\"wp-image-5893\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-225.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-225.png 741w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-225-300x198.png 300w\" sizes=\"auto, (max-width: 741px) 100vw, 741px\" \/><\/p>\n<p>For more options on the command options, use the duf help command as shown.<\/p>\n<pre><strong>$ duf --help<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"909\" height=\"522\" class=\"wp-image-5894\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-226.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-226.png 909w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-226-300x172.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-226-768x441.png 768w\" sizes=\"auto, (max-width: 909px) 100vw, 909px\" \/><\/p>\n<p>Additionally, feel free to visit the DUF GitHub page for more information.<\/p>","protected":false},"excerpt":{"rendered":"<p>The good old df command sure does a decent job in keeping tabs on the disk space usage. That\u2019s not in doubt. However, a new tool in the&hellip;<\/p>","protected":false},"author":1,"featured_media":5957,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,4,5,83,165,2],"tags":[286,287],"class_list":["post-5883","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","category-debian","category-mint","category-opensuse","category-red-hat","category-ubuntu","tag-disk-usage","tag-duf-command-line-utility"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/5883","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\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=5883"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/5883\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/5957"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=5883"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=5883"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=5883"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}