TranslateProject/sources/ncdu – Ncurses Based Disk Usage Utility.md
2013-10-22 18:53:49 +08:00

4.5 KiB
Raw Blame History

ncdu Ncurses Based Disk Usage Utility

uts a few days back, we discussed gt5 (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.

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

> Output

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 :

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 :

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 :

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 :

For command line options and other information, go through the man page of ncdu command.

Download/Install/Configure

Here are some of the important links related to ncdu command :

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 校对:校对者ID

本文由 LCTT 原创翻译,Linux中国 荣誉推出