Merge pull request #13786 from tomjlw/master

Submit Translated Passage for Review
This commit is contained in:
Xingyu.Wang 2019-05-24 02:04:52 +08:00 committed by GitHub
commit 1d0753480e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 257 additions and 261 deletions

View File

@ -1,261 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (tomjlw)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Duc A Collection Of Tools To Inspect And Visualize Disk Usage)
[#]: via: (https://www.ostechnix.com/duc-a-collection-of-tools-to-inspect-and-visualize-disk-usage/)
[#]: author: (sk https://www.ostechnix.com/author/sk/)
Duc A Collection Of Tools To Inspect And Visualize Disk Usage
======
![Duc - A Collection Of Tools To Inspect And Visualize Disk Usage][1]
**Duc** is a collection of tools that can be used to index, inspect and visualize disk usage on Unix-like operating systems. Dont think of it as a simple CLI tool that merely displays a fancy graph of your disk usage. It is built to scale quite well on huge filesystems. Duc has been tested on systems that consisted of more than 500 million files and several petabytes of storage without any problems.
Duc is quite fast and versatile tool. It stores your disk usage in an optimized database, so you can quickly find where your bytes are as soon as the index is completed. In addition, it comes with various user interfaces and back-ends to access the database and draw the graphs.
Here is the list of currently supported user interfaces (UI):
1. Command line interface (ls),
2. Ncurses console interface (ui),
3. X11 GUI (duc gui),
4. OpenGL GUI (duc gui).
List of supported database back-ends:
* Tokyocabinet,
* Leveldb,
* Sqlite3.
Duc uses **Tokyocabinet** as default database backend.
### Install Duc
Duc is available in the default repositories 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
```
On other Linux distributions, you may need to manually compile and install Duc from source as shown below.
Download latest duc source .tgz file from the [**releases**][2] page on github. As of writing this guide, the latest version was **1.4.4**.
```
$ wget https://github.com/zevv/duc/releases/download/1.4.4/duc-1.4.4.tar.gz
```
Then run the following commands one by one to install DUC.
```
$ tar -xzf duc-1.4.4.tar.gz
$ cd duc-1.4.4
$ ./configure
$ make
$ sudo make install
```
### Duc Usage
The typical usage of duc is:
```
$ duc <subcommand> <options>
```
You can view the list of general options and sub-commands by running the following command:
```
$ duc help
```
You can also know the the usage of a specific subcommand as below.
```
$ duc help <subcommand>
```
To view the extensive list of all commands and their options, simply run:
```
$ duc help --all
```
Let us now se some practical use cases of duc utility.
### Create Index (database)
First of all, you need to create an index file (database) of your filesystem. To create an index file, use “duc index” command.
For example, to create an index of your **/home** directory, simply run:
```
$ duc index /home
```
The above command will create the index of your /home/ directory and save it in **$HOME/.duc.db** file. If you have added new files/directories in the /home directory in future, just re-run the above command at any time later to rebuild the index.
### Query Index
Duc has various sub-commands to query and explore the index.
To view the list of available indexes, run:
```
$ duc info
```
**Sample output:**
```
Date Time Files Dirs Size Path
2019-04-09 15:45:55 3.5K 305 654.6M /home
```
As you see in the above output, I have already indexed the /home directory.
To list all files and directories in the current working directory, you can do:
```
$ duc ls
```
To list files/directories in a specific directory, for example **/home/sk/Downloads** , just pass the path as argument like below.
```
$ duc ls /home/sk/Downloads
```
Similarly, run **“duc ui”** command to open a **ncurses** based console user interface for exploring the file system usage and run **“duc gui”** to start a **graphical (X11)** interface to explore the file system.
To know more about a sub-command usage, simply refer the help section.
```
$ duc help ls
```
The above command will display the help section of “ls” subcommand.
### Visualize Disk Usage
In the previous section, we have seen how to list files and directories using duc subcommands. In addition, you can even show the file sizes in a fancy graph.
To show the graph of a given path, use “ls” subcommand like below.
```
$ duc ls -Fg /home/sk
```
Sample output:
![][3]
Visualize disk usage using “duc ls” command
As you see in the above output, the “ls” subcommand queries the duc database and lists the inclusive size of all
files and directories of the given path i.e **/home/sk/** in this case.
Here, the **“-F”** option is used to append file type indicator (one of */) to entries and the **“-g”** option is used to draw graph with relative size for each entry.
Please note that if no path is given, the current working directory is explored.
You can use **-R** option to view the disk usage result in [**tree**][4] structure.
```
$ duc ls -R /home/sk
```
![][5]
Visualize disk usage in tree structure
To query the duc database and open a **ncurses** based console user interface for exploring the disk usage of given path, use **“ui”** subcommand like below.
```
$ duc ui /home/sk
```
![][6]
Similarly, we use **“gui”** subcommand to query the duc database and start a **graphical (X11)** interface to explore the disk usage of the given path:
```
$ duc gui /home/sk
```
![][7]
Like I already mentioned earlier, we can learn more about a subcommand usage like below.
```
$ duc help <subcommand-name>
```
I covered the basic usage part only. Refer man pages for more details about “duc” tool.
```
$ man duc
```
* * *
**Related read:**
* [**Filelight Visualize Disk Usage On Your Linux System**][8]
* [**Some Good Alternatives To du Command**][9]
* [**How To Check Disk Space Usage In Linux Using Ncdu**][10]
* [**Agedu Find Out Wasted Disk Space In Linux**][11]
* [**How To Find The Size Of A Directory In Linux**][12]
* [**The df Command Tutorial With Examples For Beginners**][13]
* * *
### Conclusion
Duc is simple yet useful disk usage viewer. If you want to quickly and easily know which files/directories are eating up your disk space, Duc might be a good choice. What are you waiting for? Go get this tool already, scan your filesystem and get rid of unused files/directories.
And, thats all for now. Hope this was useful. More good stuffs to come. Stay tuned!
Cheers!
**Resource:**
* [**Duc website**][14]
--------------------------------------------------------------------------------
via: https://www.ostechnix.com/duc-a-collection-of-tools-to-inspect-and-visualize-disk-usage/
作者:[sk][a]
选题:[lujun9972][b]
译者:[tomjlw](https://github.com/tomjlw)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.ostechnix.com/author/sk/
[b]: https://github.com/lujun9972
[1]: https://www.ostechnix.com/wp-content/uploads/2019/04/duc-720x340.png
[2]: https://github.com/zevv/duc/releases
[3]: http://www.ostechnix.com/wp-content/uploads/2019/04/duc-1-1.png
[4]: https://www.ostechnix.com/view-directory-tree-structure-linux/
[5]: http://www.ostechnix.com/wp-content/uploads/2019/04/duc-2.png
[6]: http://www.ostechnix.com/wp-content/uploads/2019/04/duc-3.png
[7]: http://www.ostechnix.com/wp-content/uploads/2019/04/duc-4.png
[8]: https://www.ostechnix.com/filelight-visualize-disk-usage-on-your-linux-system/
[9]: https://www.ostechnix.com/some-good-alternatives-to-du-command/
[10]: https://www.ostechnix.com/check-disk-space-usage-linux-using-ncdu/
[11]: https://www.ostechnix.com/agedu-find-out-wasted-disk-space-in-linux/
[12]: https://www.ostechnix.com/find-size-directory-linux/
[13]: https://www.ostechnix.com/the-df-command-tutorial-with-examples-for-beginners/
[14]: https://duc.zevv.nl/

View File

@ -0,0 +1,257 @@
[#]: collector: (lujun9972)
[#]: translator: (tomjlw)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Duc A Collection Of Tools To Inspect And Visualize Disk Usage)
[#]: via: (https://www.ostechnix.com/duc-a-collection-of-tools-to-inspect-and-visualize-disk-usage/)
[#]: author: (sk https://www.ostechnix.com/author/sk/)
Duc——一个能够洞察并可视化硬盘使用情况的工具包
======
![Duc——一个能够洞察并可视化硬盘使用情况的工具包][1]
**Duc** 是一个在类 Unix 操作系统上可以用来索引、洞察及可视化硬盘使用情况的工具包。别把它当成一个仅能用漂亮图表展现硬盘使用情况的 CLI 工具。它被设计成在巨大的文件系统上也可以延展得很好。Duc 已在由超过五亿个文件和几 PB 的存储组成的系统上测试过,没有任何问题。
Duc 是一个快速而且多变的工具。它将你的硬盘使用情况存在一个优化过的数据库里,这样你就可以在索引完成后迅速找到你的数据。此外,它自带不同的用户交互界面与后端以访问数据库并绘制图表。
以下列出的是目前支持的用户界面UI
1. 命令行界面 (ls),
2. Ncurses 控制台界面 (ui),
3. X11 GUI (duc gui),
4. OpenGL GUI (duc gui)。
支持的后端数据库:
* Tokyocabinet,
* Leveldb,
* Sqlite3.
Duc 使用 **Tokyocabinet** 作为默认的后端数据库。
### 安装 Duc
Duc 可以从 Debian 以及其衍生品例如 Ubuntu 的默认仓库中获取。因此在基于 DEB 的系统上安装 Duc 小菜一碟。
```
$ sudo apt-get install duc
```
在其它 Linux 发行版上你需要像以下所展示的那样手动从源编译安装 Duc。
从 github 上的[**发行**][2]页面下载最新的 Duc 源 .tgz 文件。在写这篇教程的时候,最新的版本是**1.4.4**。
```
$ wget https://github.com/zevv/duc/releases/download/1.4.4/duc-1.4.4.tar.gz
```
然后一个接一个地运行以下命令来安装 DUC。
```
$ tar -xzf duc-1.4.4.tar.gz
$ cd duc-1.4.4
$ ./configure
$ make
$ sudo make install
```
### 使用 Duc
duc 的典型用法是:
```
$ duc <subcommand> <options>
```
你可以通过运行以下命令来浏览总的选项列表以及副命令:
```
$ duc help
```
你也可以像下面这样了解一个特定副命令的用法。
```
$ duc help <subcommand>
```
要查看所有命令与其选项的列表,仅需运行:
```
$ duc help --all
```
让我们看看一些 duc 工具的特定用法。
### 创建索引(数据库)
首先你需要创建一个你文件系统的索引文件数据库。使用“duc index”命令以创建索引文件。
比如说,要创建你的 **/home** 目录的索引,仅需运行:
```
$ duc index /home
```
上述命令将会创建你的 /home/ 目录的索引并将其保存在 **$HOME/.duc.db** 文件中。如果你以后需要往 /home 目录添加新的文件/目录,只要在之后重新运行一下上面的命令来重建索引。
### 查询索引
Duc 有不同的副命令来查询并探索索引。
要查看可访问的索引列表,运行:
```
$ duc info
```
**示例输出:**
```
日期 时间 文件 目录 大小 路径
2019-04-09 15:45:55 3.5K 305 654.6M /home
```
如你在上述输出所见,我已经索引好了 /home 目录。
要列出当前工作目录中所有的文件和目录,你可以这样做:
```
$ duc ls
```
要列出所提供目录例如 **/home/sk/Downloads** 中的文件/目录,仅需像下面这样将路径作为参数传过去。
```
$ duc ls /home/sk/Downloads
```
类似的,运行**“duc ui”**命令来打开基于 **ncurses** 的控制台用户界面以探索文件系统使用情况,运行**“duc gui”**以打开 **graphical (X11)** 界面来探索文件系统。
要了解更多副命令的用法,仅需参考帮助部分。
```
$ duc help ls
```
上述命令将会展现 “ls” 副命令的帮助部分。
### 可视化硬盘使用状况
在之前的部分我们以及看到如何用 duc 副命令列出文件和目录。在此之外,你甚至可以用一张漂亮的图表展示文件大小。
要展示所提供目录的图表像以下这样使用“ls”副命令。
```
$ duc ls -Fg /home/sk
```
示例输出:
![使用 “duc ls” 命令可视化硬盘使用情况][3]
如你在上述输出所见“ls”副命令查询 duc 数据库并列出了所提供目录,在这里就是 **/home/sk/**,所包含的文件与目录的大小。
这里 **-F** 选项是往条目中用来添加文件类型显示(*/之一),**-g** 选项是用来绘制每个条目相对大小的图表。
请注意如果未提供任何路径,当前工作目录就会被探索。
你可以使用 **-R** 选项来用[**树状结构**][4]浏览硬盘使用情况。
```
$ duc ls -R /home/sk
```
![用树状结构可视化硬盘使用情况][5]
要查询 duc 数据库并打开基于 **ncurses** 的控制台以探索所提供的目录,像以下这样使用**“ui”**副命令。
```
$ duc ui /home/sk
```
![][6]
类似的,我们使用**“gui”* 副命令来查询 duc 数据库以及打开一个 **graphical (X11)** 界面来探索提供路径的硬盘使用情况。
```
$ duc gui /home/sk
```
![][7]
像我之前所提到的,我们可以像下面这样了解更多关于特定副命令的用法。
```
$ duc help <副命令名字>
```
我仅仅覆盖了基本用法的部分,参考 man 页面了解关于“duc”工具的更多细节。
```
$ man duc
```
* * *
**相关阅读:**
* [**Filelight 在你的 Linux 系统上可视化硬盘使用情况**][8]
* [**一些好的du命令的替代品**][9]
* [**如何在 Linux 中用 Ncdu 检查硬盘使用情况**][10]
* [**Agedu——发现 Linux 中被浪费的硬盘空间**][11]
* [**如何在 Linux 中找到目录大小**][12]
* [**为初学者打造的带有示例的 df 命令教程**][13]
* * *
### 总结
Duc 是一款简单却有用的硬盘使用查看器。如果你想要快速简便地知道哪个文件/目录占用你的硬盘空间Duc 可能是一个好的选择。你还等什么呢?获取这个工具,扫描你的文件系统,摆脱无用的文件/目录。
现在就到此为止了。希望这篇文章有用处。更多好东西马上就到。保持关注!
欢呼吧!
**资源:**
* [**Duc 网站**][14]
--------------------------------------------------------------------------------
via: https://www.ostechnix.com/duc-a-collection-of-tools-to-inspect-and-visualize-disk-usage/
作者:[sk][a]
选题:[lujun9972][b]
译者:[tomjlw](https://github.com/tomjlw)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.ostechnix.com/author/sk/
[b]: https://github.com/lujun9972
[1]: https://www.ostechnix.com/wp-content/uploads/2019/04/duc-720x340.png
[2]: https://github.com/zevv/duc/releases
[3]: http://www.ostechnix.com/wp-content/uploads/2019/04/duc-1-1.png
[4]: https://www.ostechnix.com/view-directory-tree-structure-linux/
[5]: http://www.ostechnix.com/wp-content/uploads/2019/04/duc-2.png
[6]: http://www.ostechnix.com/wp-content/uploads/2019/04/duc-3.png
[7]: http://www.ostechnix.com/wp-content/uploads/2019/04/duc-4.png
[8]: https://www.ostechnix.com/filelight-visualize-disk-usage-on-your-linux-system/
[9]: https://www.ostechnix.com/some-good-alternatives-to-du-command/
[10]: https://www.ostechnix.com/check-disk-space-usage-linux-using-ncdu/
[11]: https://www.ostechnix.com/agedu-find-out-wasted-disk-space-in-linux/
[12]: https://www.ostechnix.com/find-size-directory-linux/
[13]: https://www.ostechnix.com/the-df-command-tutorial-with-examples-for-beginners/
[14]: https://duc.zevv.nl/