Install dua on Ubuntu 24.04

Install dua on Ubuntu 24.04

The dua command line tool, short for "Disk Usage Analyzer", is a utility designed to help users quickly analyze and visualize disk usage in a terminal. It is similar to the du command but offers a more interactive and user-friendly experience. This tutorial explains how to install dua on Ubuntu 24.04.

Install dua

Run the command below to fetch the most recent version tag of the dua release and store it in a variable:

DUA_VERSION=$(curl -s "https://api.github.com/repos/Byron/dua-cli/releases/latest" | grep -Po '"tag_name": "v\K[0-9.]+')

Download the tar.gz file from the releases page of the dua repository:

wget -qO dua.tar.gz https://github.com/Byron/dua-cli/releases/latest/download/dua-v$DUA_VERSION-x86_64-unknown-linux-musl.tar.gz

Create temporary directory and extract a tar.gz file:

mkdir dua-temp
tar xf dua.tar.gz --strip-components=1 -C dua-temp

Move executable to /usr/local/bin directory:

sudo mv dua-temp/dua /usr/local/bin

We can check dua version as follows:

dua --version

Remove unneeded file and directory:

rm -rf dua.tar.gz dua-temp

Testing dua

Execute the dua command with no parameters to view the disk space usage in the current working directory.

dua

To view the disk space usage of a specific directory, provide the directory path as an argument. For instance, to analyze the /usr/local directory, use the following command:

sudo dua /usr/local
Disk space usage of usr/local directory using dua on Ubuntu

Uninstall dua

To uninstall dua, remove the related file:

sudo rm -rf /usr/local/bin/dua

Leave a Comment

Cancel reply

Your email address will not be published.