April 2014
M T W T F S S
« Mar    
 123456
78910111213
14151617181920
21222324252627
282930  
161

Refs

Categories

Archives

profile for slm on Stack Exchange, a network of free, community-driven Q&A sites

Command Line Tools for Analyzing Disk Usage on Fedora/CentOS/RHEL

Background

Here’s a quick rundown of some command line tools that can be used to determine disk usage on a Linux box. Most of these are command line based, meaning that you can use them from within a shell. But they aren’t just commands, they’re full blown applications that you can run from within a terminal!

ncdu – NCurses Disk Usage

The first tool is called ncdu. It’s obviously ncurses based but don’t let that fool you. It’s feature rich and has a nice clean interface and it works from within a shell. See the man page for complete usage details. Installation is a snap:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
% sudo yum install ncdu
Loaded plugins: langpacks, presto, refresh-packagekit
Adding en_US to language list
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package ncdu.x86_64 0:1.6-1.fc13 set to be installed
--> Finished Dependency Resolution
 
Dependencies Resolved
 
====================================================================================
 Package        Arch              Version                   Repository         Size
====================================================================================
Installing:
 ncdu           x86_64            1.6-1.fc13                fedora             26 k
 
Transaction Summary
====================================================================================
Install       1 Package(s)
 
Total download size: 26 k
Installed size: 46 k
Is this ok [y/N]: y
Downloading Packages:
Setting up and reading Presto delta metadata
Processing delta metadata
Package(s) data still to download: 26 k
ncdu-1.6-1.fc13.x86_64.rpm                                   |  26 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : ncdu-1.6-1.fc13.x86_64                                       1/1 
 
Installed:
  ncdu.x86_64 0:1.6-1.fc13                                                          
 
Complete!

Once installed you can run it via the command line like this:

1
% ncdu

Here’s some screenshots of ncdu going through it’s paces:

gt5 – a diff-capable ‘du-browser’

Another nice app, gt5. It’s highly ‘portable’, as it only depends on some GNU-utilities and it can run on the console, xterm or remotely over ssh.

Here’s a list of some of it’s other features:

  • display diskspace used by files & directories within a directory
  • display what’s happened since the last ran (see screenshots below)
  • optionally provides links to the files, so you can also browse them
  • displays entries with their size & the percentage of their parent
  • ommits small files/directories
  • easy browsing using the cursor-keys
  • produces html files for browsing ‘offline’ afterwards

Again, installation is simple via yum:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
% sudo yum install gt5
Loaded plugins: langpacks, presto, refresh-packagekit
Adding en_US to language list
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package gt5.noarch 0:1.4.0-7.fc12 set to be installed
--> Finished Dependency Resolution
 
Dependencies Resolved
 
====================================================================================
 Package        Arch              Version                   Repository         Size
====================================================================================
Installing:
 gt5            noarch            1.4.0-7.fc12              fedora             20 k
 
Transaction Summary
====================================================================================
Install       1 Package(s)
 
Total download size: 20 k
Installed size: 39 k
Is this ok [y/N]: y
Downloading Packages:
Setting up and reading Presto delta metadata
Processing delta metadata
Package(s) data still to download: 20 k
gt5-1.4.0-7.fc12.noarch.rpm                                  |  20 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : gt5-1.4.0-7.fc12.noarch                                      1/1 
 
Installed:
  gt5.noarch 0:1.4.0-7.fc12                                                         
 
Complete!

Once installed you can run it like so:

1
% gt5

… and here are a couple of screenshots …

Disk Usage Analyzer (aka. Baobab)

The final app, Baobab, is actually included by default in GNOME. It’s a GTK+ application so you can’t just run it in a terminal but it’s still nice to use on a stock GNOME desktop. Baobab has the following features:

  • Single folder scan
  • Remote scan
  • Monitoring of Home
  • Display Data in Treemaps or as Ringschart

Here’s some screenshots:

Refer to its usage page for more details.

Others to Check Out

In particular fsview is a very nice GUI. I like how it organizes the the disk usage visually. It’s actually a KDE application (a plugin to Konqueror) but runs just fine under GNOME. It’s typically part of a package called kdeaddons, and shows up in the Applications menu as “File System Viewer” under Accessories. You can also check out the fsview man page.

Here’s some screenshots:

References

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>