This article introduces Duc, a tool for visually viewing disk usage on a Linux system.
Duc is a toolset that indexes, examines, and visualizes a system’s disks on unix-like operating systems. Compared with other similar tools, it works well on very large file systems. Tests showed that Duc could work without problem on 500 million files, with a total size of several petabytes.
Duc is a very fast and convenient tool that optimizes your disk usage and stores it in a database. So, after the index is created, you can find your files very quickly.
In addition, it has a variety of user interfaces and supports a variety of database formats. It supports the following user interfaces:
-
Command line interface;
-
Ncurses terminal interface;
-
X11 GUI
-
OpenGL GUI
The following database formats are supported:
-
Tokyocabinet,
-
Leveldb,
-
Sqlite3.
By default, Duc uses Tokyocabinet as its database.
Duc tool installation
For the Debian family and its derivatives, it is very easy to install as follows:
$ sudo apt-get install ducCopy the code
For other systems, you can install using source code. You can download the source code first:
$wget HTTP: / / https://github.com/zevv/duc/releases/download/1.4.4/duc-1.4.4.tar.gzCopy the code
Then use the following command to compile and complete the installation:
$tar - XZF duc- 1.1.4.tar. gz $cdDu-1.4.4 $./configure $make $sudo make installCopy the code
How to use Duc tools
The general method of using the Duc tool is as follows:
$ duc <subcommand> <options>Copy the code
You can use the following command to view the list of general options and subcommands for Duc:
$ duc helpCopy the code
You can also use the following command to view a specific subcommand of the Duc:
$ duc help <subcommand>Copy the code
To see an exhaustive list of all the commands and their options, simply run:
$ duc help --allCopy the code
Next, let’s look specifically at how the Duc tool is used.
1. Create database indexes
In the beginning, we will create an index for our disk file system. The creation process is as simple as running the duc index command.
For example, if you want to create an index for the /home directory, simply run:
$ duc index /homeCopy the code
The above command will create an index for your /home directory and store the index in the $home /.duc.db file. If you create a new file in that directory, simply run the command again to create a new index.
2. Query database indexes
Duc has multiple sub-commands to query and browse indexes. To query the list of available indexes, run:
$ duc infoCopy the code
The running results are as follows:
Date Time Files Dirs Size Path
2019-04-09 15:45:55 3.5K 305 654.6M /homeCopy the code
As you can see, I have indexed the /home directory. To list all files and directories in your current working directory, you can run:
$ duc lsCopy the code
To list the files and directories in a specific directory, such as /home/alvin-/ Downloads, simply pass the path to the following command:
$ duc ls /home/alvin/DownloadsCopy the code
If you need to know how to use a particular subcommand, you can use its reference documentation. For example, if you want to know how to use the ls subcommand, you can do this:
$ duc help lsCopy the code
3. Visualize the disk usage
In the previous section, we saw how to use the duc command to list files and directories. But that’s not intuitive. We can also use diagrams to show the size of the file.
If we wanted to graph a given directory, we could use the ls subcommand as follows:
$ duc ls -Fg /home/alvinCopy the code
The following output is displayed:
In this result, the ls subcommand queries and lists all files and directories in the specified directory and displays them graphically.
Here, the -f option is used to append a file type indicator (one of */) to an entry, and the -g option is used to graph the relative size of each entry.
If no directory is specified, the default is the current directory usage.
You can also use the -r option to view disk usage in a tree:
$ duc ls -R /home/alvinCopy the code
Similarly, you can run the duc UI command to open an Ncurses terminal to browse your files:
$ duc ui /home/alvinCopy the code
Similarly, you can run the DUC GUI to open a graphical (X11) to view your filesystem:
$ duc gui /home/alvinCopy the code
This is the basic usage of the Duc tool. To learn more about its power, check out its help documentation:
$ man ducCopy the code
Code word is not easy, if you think it is helpful, please click a “like” and then go ~
—————–
I am good xu, the world’s top 500 foreign companies Linux development engineer, specializing in the production of Linux dry goods. Welcome to pay attention to my public number “liang Xu Linux”, reply “1024” to obtain the latest and most complete technical information, reply “into the group” into the master such as cloud technology exchange group.