Merge pull request #384 from Linux-pdz/master

translating  Ncurses Based Disk Usage Utility
This commit is contained in:
Xingyu.Wang 2013-11-10 17:15:28 -08:00
commit dea9ea1ad5
2 changed files with 115 additions and 117 deletions

View File

@ -1,117 +0,0 @@
ncdu Ncurses Based Disk Usage Utility
================================================================================
uts a few days back, we discussed [gt5][1] (a graphical front-end to du). Continuing with this series of du alternatives, today we will discuss a ncurses based disk usage utility that can be run on a remote server set-up which does not have a graphical environment. The command line utility we are about to discuss is **ncdu**.
### ncdu Ncurses Based du Alternative ###
The command line utility ncdu is nothing but a curses based version of the standard du command. It helps to quickly view the disk usage statistics of a system even if there is no graphical environment installed on it.
![](http://mylinuxbook.com/wp-content/uploads/2013/10/ncdu-main.png)
### Testing Environment ###
- OS Ubuntu 13.04
- Shell Bash 4.2.45
- Application ncdu 1.9
### A Brief Tutorial ###
Here are some of the examples of ncdu command :
**1. The Default Output**
Just execute the **ncdu** command and youll observe that first it scans the disk and then displays the disk usage of various directories in descending order.
Here is an example :
**> Scanning**
![](http://mylinuxbook.com/wp-content/uploads/2013/10/ncdu-0.png)
**> Output**
![](http://mylinuxbook.com/wp-content/uploads/2013/10/ncdu-1.png)
So you can see that a disk usage table is displayed in the output. If you want to scan complete file system, use the -x option with ncdu utility.
**2. Get More Information On Selected Directory By Pressing i**
As you can see that the first entry is selected by default. To know more details related to a selected entry, just press i.
Here is an example :
![](http://mylinuxbook.com/wp-content/uploads/2013/10/ncdu-2.png)
So you can see that the information like Path, Type, Disk Usage, Apparent size etc. were displayed. To get rid of this window, just press i again.
**3. Delete A Directory From Within The ncdu Interface**
To delete a directory from within the ncdu interface, just select the entry and press d.
Here is an example :
![](http://mylinuxbook.com/wp-content/uploads/2013/10/ncdu-3.png)
So you can see that ncdu asks for a confirmation from the user. If you press yes, the directory will be deleted from the system.
**4. Show Percentage Of Total Disk Consumption By Each Directory**
Press g to display percentage of total disk consumption by each directory.
Here is an example :
![](http://mylinuxbook.com/wp-content/uploads/2013/10/ncdu-4.png)
So you can see that percentage consumption of total disk for each entry is displayed in the second column of output.
**5. Get Help Regarding All The Available Hot Keys**
Press ? to get help related to hot keys, format information and ncdu version related information.
Here are some help snapshots :
![](http://mylinuxbook.com/wp-content/uploads/2013/10/ncdu-5-1.png)
![](http://mylinuxbook.com/wp-content/uploads/2013/10/ncdu-5-2.png)
![](http://mylinuxbook.com/wp-content/uploads/2013/10/ncdu-5-3.png)
For command line options and other information, go through the [man page of ncdu command][2].
### Download/Install/Configure ###
Here are some of the important links related to ncdu command :
- [Home Page][3]
- [Download Link][4]
Alternatively, ncdu can also be downloaded by command line managers like apt-get , yum etc. Additionally, Ubuntu users can use Ubuntu Software Centre to download this utility.
### Pros ###
- Quick access to a lot of information
- Light on resources
### Cons ###
- Doesnt come pre-installed on most of the Linux distributions
- Has a bit of learning curve associated with it.
### Conclusion ###
If you are not satisfied with the standard du command and are looking for a fast, ncurses based du-like utility then try out ncdu. It provides lots of customization options. Youll definitely like it.
**Have you ever used ncdu, gt5 or any other du-like utility? Share your experience with us.**
--------------------------------------------------------------------------------
via: http://mylinuxbook.com/ncdu-ncurses-based-disk-usage-utility/
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:http://mylinuxbook.com/gt5-a-graphical-alternative-to-du/
[2]:http://linux.die.net/man/1/ncdu
[3]:http://dev.yorhel.nl/ncdu
[4]:http://dev.yorhel.nl/ncdu

View File

@ -0,0 +1,115 @@
ncdu-基于Ncurses的磁盘实用工具
===
几天前,我们谈论了[gt5][1]一个具有图形前端的磁盘实用工具。接着上次继续介绍可供选择的磁盘实用工具我们今天要讨论的是一个基于ncurese的磁盘实用工具可以远程运行但没有图形界面。我们要介绍的这个命令行工具叫做**ncdu**。
###ncdu-基于Ncurses的du可选程序
这个命令行工具是一个基于curses版本的标准du命令。它可帮你在没有安装图形环境的情况下快速查看系统的磁盘使用统计
![](http://mylinuxbook.com/wp-content/uploads/2013/10/ncdu-main.png)
###检测环境
- 操作系统 Ubuntu 13.04
- Shell Bash 4.2.45
- 应用 ncdu 1.9
###一个简要手册
这儿是一些ncdu命令的例子
**1. 默认输出**
执行以下**ncdu**命令,你会观察到,它会先扫描磁盘然后以递减的顺序显示各个目录下的空间使用情况。
**> 扫描**
![](http://mylinuxbook.com/wp-content/uploads/2013/10/ncdu-0.png)
**> 输出**
![](http://mylinuxbook.com/wp-content/uploads/2013/10/ncdu-1.png)
你会看到在输出里显示了一个磁盘使用情况表。假如你要扫描整个文件系统,你可以在运行**ncdu**命令时加上**-x**选项。
**2. 按i可以得到选定目录的更多信息**
如你所见,第一项默认选中。想要知道选定项的更多信息,可以按**i**。
下面给出一个例子:
![](http://mylinuxbook.com/wp-content/uploads/2013/10/ncdu-2.png)
如你所见,显示了目录,类型,大小,实际占用空间等。项返回,再按一次**i**。
**3. 在ncdu的界面中删除目录**
在ncdu的界面中删除目录只需要选中目录然后按**d**。
下面给出一个例子:
![](http://mylinuxbook.com/wp-content/uploads/2013/10/ncdu-3.png)
如你所见ncdu请求用户确认。假如你选择yes,目录将会从系统中删除。
**4. 显示每一个目录的磁盘使用占总的磁盘空间的百分比**
按**g**显示每个目录大小占总的磁盘空间的百分比。
下面给出一个例子:
![](http://mylinuxbook.com/wp-content/uploads/2013/10/ncdu-4.png)
如你所见,在输出结果的第二竖列显示了每个目录的占用的空间占总的磁盘空间的百分比。
**5. 获悉有关所有可使用快捷键的**
按****可获得有关快捷键格式以及有关ncdu版本的信息。
下面给出一些例子:
![](http://mylinuxbook.com/wp-content/uploads/2013/10/ncdu-5-1.png)
![](http://mylinuxbook.com/wp-content/uploads/2013/10/ncdu-5-2.png)
![](http://mylinuxbook.com/wp-content/uploads/2013/10/ncdu-5-3.png)
想知道有关命令行选项以及其他信息,可前往[ncdu命令的Man页面][2]。
###下载/安装/配置
这儿是一些有关ncdu命令的重要链接
- [Home Page][3]
- [Download Link][4]
当然你也可以通过命令方式下载安装比如apt-getyum等。另外Ubuntu用户可使用Ubuntu软件中心下载安装这个工具。
###优点
- 信息显示快速
- 系统资源消耗小
###缺点
- 在大多数Linux发行版中均没有预安装
- 有一定的学习曲线
###结论
假如你不满足于标准的du工具想去寻找一款快速的基于ncurses的类du工具那么你可以试试ncdu。它提供了许多自定义选项。你一定会喜欢它的。
**你使用过ncdu,gt5或者其他任何类du工具吗欢迎和我们分享你的使用经验。**
---
via: http://mylinuxbook.com/ncdu-ncurses-based-disk-usage-utility/
译者:[Linux-pdz](https://github.com/Linux-pdz) 校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:http://mylinuxbook.com/gt5-a-graphical-alternative-to-du/
[2]:http://linux.die.net/man/1/ncdu
[3]:http://dev.yorhel.nl/ncdu
[4]:http://dev.yorhel.nl/ncdu