DUF Command in Ubuntu Linux – Usage and Examples

The duf utility is nothing but an enhancement of what du and df commands do to check used and free space in a structured and eye-pleasing way. Duf is one of the new CLI tools that is gaining quite some popularity among Linux users.

To install duf on Ubuntu, you can use the apt package manager: 

Command: apt install duf

duf command Examples and Usage Ubuntu Techhyme

You can simply use duf without any options and it will get you a list of mounted devices:

Command: duf

duf command Examples and Usage Ubuntu Techhyme

You can use duf to list one or more devices at the same time. You just have to specify the path of the mounting port or device and that’s it:

Command: duf /dev /media/root/Ubuntu 22.04.1 LTS amd64/

duf command Examples and Usage Ubuntu Techhyme

The duf utility provides various options so that you can filter output and have intended results. For instance, you can the –only option to show only specific devices:

Command: duf –only local

duf command Examples and Usage Ubuntu Techhyme

And if you want to list specific filesystems, you can use –only-fs and append filesystem types.

Command: duf –only-fs tmpfs

duf command Examples and Usage Ubuntu Techhyme

Furthermore, you can also sort the output based on a variety of keys such as size, usage, and more using the –sort option.

Command: duf –sort usage

duf command Examples and Usage Ubuntu Techhyme

If you want the output in JSON format, then you can use –json option:

Command: duf –json

duf command Examples and Usage Ubuntu Techhyme

In case, if you want to save the output in a text file, you can redirect the standard output to the text file:

Command: duf –json > techhyme.json

duf command Examples and Usage Ubuntu Techhyme

You may also read:

Leave a Reply