📅 June 10, 2020     🕐 4 minutes read

Tools to Check Disk Usage in Linux and macOS

awesome free and open source tools to check out disk usage on Linux and macOS

Hard drives, SSDs, flash drives, SD cards and so on. All storage solutions that will, sooner or later, run out of space. When they do, you will probably ask yourself where did all the space go?

To answer that question you can use a disk usage viewing tool. There are various third party commercial tools that you can use, but if you’re running Linux or macOS you can take advantege of the terminal which comes with built-in tools or use third party free and open source tools.

ALSO READ HOW TO: Create Time-Saving Aliases

 

1. Using du and df

These are two standard Unix programs that complement eachother. du stands for disk usage and df stands for disk free.

 

To use these commands, you can execute them as is (i.e du or df ) or read the manual with man df and man du to see all the options.

 

 

2. Using dust

Dust is, as the developer puts it, like du but more intuitive. Dust is meant to give you an instant overview of which directories are using disk space without requiring sort or head.

 

Install dust:

  • Linux: cargo install du-dust or download binary ( Arch users can find dust in AUR )
  • macOS: using Homebrew. brew install dust or download binary
  • Windows: download binary ( NOTE: I’m not sure how the Windows binary works. I don’t have any Windows machines, not even a VM )

 

Usage:


dust <dir>
dust <dir>  <another_dir> <and_more>
dust -p <dir>  (full-path - does not shorten the path of the subdirectories)
dust -s <dir>  (apparent-size - shows the length of the file as opposed to the amount of disk space it uses)
dust -n 30  <dir>  (shows 30 directories instead of the default)
dust -d 3  <dir>  (shows 3 levels of subdirectories)
dust -r  <dir>  (reverse order of output, with root at the lowest)
dust -x  <dir>  (only show directories on the same filesystem)
dust -X ignore  <dir>  (ignore all files and directories with the name 'ignore')
dust -b <dir>  (do not show percentages or draw ASCII bars)

 

 

3. DUC – Dude, where are my bytes

Duc is a collection of tools for indexing, inspecting and visualizing disk usage. Duc maintains a database of accumulated sizes of directories of the file system, and allows you to query this database with some tools, or create fancy graphs showing you where your bytes are.

 

Install DUC:

 

Usage:

Duc comes with a command line tool called duc, which is used to create, maintain and query the disk usage database. To see a list of available commands run duc help or run man duc for an extensive documentation.

First you need to index a directory you want to run duc against. It can be / , /usr or  /home/username.  This will create a database on ~/.duc.db.

NOTE: macOS users will have to index /Users/username instead of /home/username and I see no point in indexing just /usr

Once the desired directory is indexed, you can list all files and directories , showing relative file sizes in a graph with duc ls -Fg /indexed/directory

 

However, duc comes with an UI and a GUI interface. Which makes duc even more useful. To show the UI interface you will need to run duc ui /indexed/directory. This will return the ncurses console interaface which can be navigated with the keyboard.

 

To start the graphical interface and explore the filesystem using a sunburst graph run duc gui /indexed/directory. This interface can be navigated with the mouse ( scroll to zoom in and out, and click to select ).

SUPPORT

FSM has no ads or affiliate links. Your support would simply pay for our servers, domain and maintanance. If there's any leftover change, we'll get some coffee and a slice of pizza.

Liberapay  
Bitcoin (BTC) 1Hfuq77gKKFJeNcq4EP4dQK3yDRWrFEwJR
Bitcoin Cash (BCH) qzmdm6e6q5wf2p6sxz2mst7cenz60newwc5m4e9js8
Ether (ETH) 0x5f02869278C24A6579d3820f52AD15936D6F9d69
Stellar (XLM) GDWT2QU2CI3GZ5XH5DTSU3IUAHZMTB6VQKKRHBYWS5YCCQOAG6OKG2OB
More content?