How to check how much disk space is being used on Linux

Endrit Qerreti

Endrit Qerreti

In this tutorial, you will learn how to install duc, and use it to check how much disk space is being used in your machine.

duc is a command line app that allows you to check how much free space left you have on your machine, where those files are located, it also helps you identify big files that may be taking too much space.

duc can be used on the terminal. However, duc comes also with a GUI, all you have to do is enable GUI, and you will see the output in a GUI window.

GUI mode on duc visualizes disk usage information in a sunburst chart, making it easier to read.

Install duc on Ubuntu 22.04

Step 1 - Install duc dependencies

To make sure you can run duc after installation, first you need to download its dependencies on your machine.

To do so, simply run the command below

sudo apt install libncursesw5-dev libcairo2-dev libpango1.0-dev build-essential 

Step 2 - Install duc

duc can be installed on any Linux distro. In Ubuntu, duc can be found on official Ubuntu repositories, and you can install duc on Ubuntu simply via the terminal.

duc is lightweight, so you don't have to worry about running it even if your machine is not powerful.

Install Duc with.

sudo apt install duc

Step 3 - Use duc

Now you have duc installed on your machine, and you should be able to use it now.

To use duc, open your terminal by pressing CTRL + ALT + T, and run the command below, to index the /usr directory.

Indexing is necessary because duc won't be able to show anything if /usr directory is not indexed and database created at  ~/.duc.db.

duc index /usr

Once database is created, proceed to read it and see information about your files.

duc ls -Fg /usr/local

To use Duc with GUI, simply run the command below

duc gui /usr 

Uninstall duc on Ubuntu 22.04

You can uninstall duc easily from your terminal, by using the apt package manager.

sudo apt remove duc 

To remove also the database that duc created, you can do so by running the command below.

sudo rm -rf ~/.duc.db

Conclusion

In this tutorial, you learned how to install and uninstall duc. We also explained how to use duc to check details about your disk usage.