Duc is a toolkit for indexing, insight, and visualization of hard disk usage on Unix-like operating systems. Don’t think of it as a CLI tool that just shows you a pretty graph of your hard drive usage. It also supports large file systems very well. Duc has been tested on systems consisting of over 500 million files and several petabytes of storage without any problems.

Duc is a fast and flexible tool. It stores your hard drive usage in an optimized database so you can find your data quickly after indexing. In addition, it comes with a different user interface and back end for accessing databases and charting.

Listed below are the currently supported user interfaces (UIs) :

  1. Command line interfaceduc ls)
  2. Ncurses Console interface (duc ui)
  3. X11 GUI (duc gui)
  4. OpenGL GUI (duc gui)

Supported back-end databases:

  • Tokyocabinet
  • Leveldb
  • Sqlite3

Duc uses Tokyocabinet as the backend database by default.

Install the Duc

Duc is available from the default repository of Debian and its derivatives such as Ubuntu. So installing Duc on deb-based systems is a piece of cake.

$ sudo apt-get install duc
Copy the code

On other Linux distributions you will need to manually compile and install Duc from source code as shown below.

You can download the.tgz file for the latest Duc source code from the distribution page on Github. At the time of writing this tutorial, the latest version is 1.4.4.

$wget HTTP: / / https://github.com/zevv/duc/releases/download/1.4.4/duc-1.4.4.tar.gzCopy the code

Then run the following commands one by one to install the DUC.

$tar - XZF duc- 1.1.4.tar. gz $cdDu-1.4.4 $./configure $make $sudo make installCopy the code

Use the Duc

Typical uses of duc are:

$ duc <subcommand> <options>
Copy the code

You can view the total list of options and subcommands by running the following command:

$ duc help
Copy the code

You can also learn about the use of a particular subcommand as follows.

$ duc help <subcommand>
Copy the code

To see a list of all commands and their options, simply run:

$ duc help --all
Copy the code

Let’s look at some specific uses of the DUC tool.

Creating an index (database)

First, you need to create an index file (database) for your file system. Use the duc index command to create the index file.

For example, to create an index for your /home directory, simply run:

$ duc index /home
Copy the code

The above command will create an index of your /home directory and save it in the $home /.duc.db file. If you need to add new files or directories to the /home directory later, just re-run the above command to rebuild the index.

Index of the query

Duc has different subcommands to query and explore indexes.

To see a list of accessible indexes, run:

$ duc info
Copy the code

Example output:

Date Time Files Dirs Size Path
2019-04-09 15:45:55 3.5K 305 654.6M /home
Copy the code

As you can see in the output above, I have indexed the /home directory.

To list all the files and directories in your current working directory, you can do this:

$ duc ls
Copy the code

To list the directories you specify, such as the files/directories in /home/sk/downloads, simply pass the path as an argument as follows.

$ duc ls /home/sk/Downloads
Copy the code

Similarly, run the DUc UI command to open the Ncurses-based console user interface to explore file system usage, and run the DUc GUI to open the graphical interface (X11) to explore the file system.

To learn more about the use of subcommands, just refer to the help section.

$ duc help ls
Copy the code

The above command will display the help portion of the LS subcommand.

Visualize hard disk usage

In the previous section we saw how to list files and directories using the duc subcommand. Beyond that, you can even have a nice chart showing file sizes.

To display a diagram of the supplied catalog, use the ls subcommand as follows.

$ duc ls -Fg /home/sk
Copy the code

Example output:

As you can see in the output above, the ls subcommand queries the DUC database and lists the size of the files and directories contained in the supplied directory, in this case /home/sk/.

Here the -f option is used to add a file type indicator (/) to the entry, and the -g option is used to plot the relative size of each entry.

Note that if no path is provided, the current working directory is used.

You can use the -r option to browse hard drive usage in a tree structure.

$ duc ls -R /home/sk
Copy the code

To query the DUC database and open the Ncurses-based console to explore the provided directories, use the UI subcommand as follows.

$ duc ui /home/sk
Copy the code

Similarly, we use GUI * subcommands to query the DUC database and open a graphical interface (X11) to see disk usage at a given path.

$ duc gui /home/sk
Copy the code

As I mentioned earlier, we can learn more about the use of specific subcommands as follows.

$ duc help< subcommand name >Copy the code

I’ve only covered basic usage, see the MAN page for more details about the DUC tool.

$ man duc
Copy the code

Related reading:

  • Filelight – Visualize hard disk usage on your Linux system
  • Some good alternatives to du commands
  • How to use Ncdu to check disk Usage in Linux
  • Agedu – Discover wasted hard disk space in Linux
  • How do I find directory sizes in Linux
  • For beginners to build with examples of df command tutorial

conclusion

Duc is a simple but useful hard drive usage viewer. If you want a quick and easy way to know which files/directories are taking up space on your hard disk, Duc might be a good choice. What are you waiting for? Get this tool and scan your file system to get rid of useless files/directories.

That’s it for now. Hope this article is useful. More good stuff is on the way. Stay tuned!

Cheers!!!!

Resources:

  • Duc website

Via: www.ostechnix.com/duc-a-colle…

Sk selected by lujun9972

This article is originally compiled by LCTT and released in Linux China