| 1 |
|
| 2 |
"gt5" or "where has my diskspace gone?" |
| 3 |
\___________________________________________/ |
| 4 |
|
| 5 |
Overview |
| 6 |
~~~~~~~~ |
| 7 |
Years ago, I was proud to own an 80MHz, 16MB RAM PC with a huge 512MB |
| 8 |
harddisk. But even on this incredibly huge harddisk, my diskspace seemed |
| 9 |
to disappear over time. So I wrote a little tool to find out where all my |
| 10 |
diskspace had gone: I called it "gettree", as it showed all files in a |
| 11 |
directory and also calculated the size of subtrees. Over the years, the |
| 12 |
OS I used changed, but the problem stayed. Using Linux, there are some |
| 13 |
tools to deal with it, but I couldn't find anything that was clearly laid |
| 14 |
out, intuitive to browse, and doesn't need X-Windows. |
| 15 |
|
| 16 |
Features |
| 17 |
~~~~~~~~ |
| 18 |
* displays the diskspace used by files and directories within a directory |
| 19 |
* displays what has happened since gt5 last ran (see screenshot below) |
| 20 |
* optionally provides links to the files, so you can also browse them |
| 21 |
* displays entries with their size and the percentage of their parent |
| 22 |
* omission of small files/directories to keep the results readable |
| 23 |
* easy browsing through subdirectories, using the cursor-keys |
| 24 |
|
| 25 |
Implementation |
| 26 |
~~~~~~~~~~~~~~ |
| 27 |
I tried different ways to do the job and settled on a small shell-script: |
| 28 |
* highly 'portable', as it only depends on some GNU-utilities |
| 29 |
* common textbrowsers are used to navigate through the results |
| 30 |
* runs on console, xterm or remotely over ssh |
| 31 |
|
| 32 |
Screenshot |
| 33 |
~~~~~~~~~~ (much more impressive if used with colors!) |
| 34 |
__________________________________________________________________________ |
| 35 |
| (p1 of 2) | |
| 36 |
| gt5 v1.4.0 (pearl:/usr/src/linux): [cut:0.1% depth:5 lines:10000] | |
| 37 |
| last check was on Thu Dec 7 20:34:17 CET 2005 (i.e. 0d, 00:47:19 ago) | |
| 38 |
| | |
| 39 |
| ---------------------------------------------------------------- | |
| 40 |
| | |
| 41 |
| ./: [442MB in 40 files or directories] +29MB | |
| 42 |
| | |
| 43 |
| 128MB [29.02%] ./drivers/ +21MB | |
| 44 |
| 63MB [14.35%] ./arch/ +17MB | |
| 45 |
| 52MB [11.79%] ./shrunken_testfile_1 -39MB | |
| 46 |
| 42MB [ 9.58%] ./include/ +8.0KB | |
| 47 |
| 41MB [ 9.29%] ./shrunken_testfile_2 -22MB | |
| 48 |
| 35MB [ 7.98%] ./fs/ +16MB | |
| 49 |
| 20MB [ 4.49%] ./net/ +8.5MB | |
| 50 |
| 19MB [ 4.41%] ./sound/ +4.4MB | |
| 51 |
| 8.9MB [ 2.03%] ./Documentation/ | |
| 52 |
| 4.8MB [ 1.09%] ./vmlinux new | |
| 53 |
| 4.8MB [ 1.09%] ./.tmp_vmlinux2 new | |
| 54 |
| 4.6MB [ 1.05%] ./.tmp_vmlinux1 new | |
| 55 |
| 2.9MB [ 0.65%] ./kernel/ +1.5MB | |
| 56 |
| 2.1MB [ 0.48%] ./crypto/ +1.5MB | |
| 57 |
| | |
| 58 |
|http://gt5.sourceforge.net/sample.html#914________________________________| |
| 59 |
|
| 60 |
Navigation |
| 61 |
~~~~~~~~~~ |
| 62 |
If you are familiar with textbrowsers there is nothing to say: gt5 produces |
| 63 |
an HTML file; go browse it. Below are the most important keys for gt5 used |
| 64 |
with links/links2/elinks/lynx: |
| 65 |
|
| 66 |
.---------------------------------------------------. |
| 67 |
| browsing in general | meaning in gt5 | |
| 68 |
====================================================================== |
| 69 |
| Cursor Left | go back | go one directory up | |
| 70 |
|----------------|-------------------------|-------------------------| |
| 71 |
| Cursor Right | follow link | open selected directory | |
| 72 |
|----------------|-------------------------|-------------------------| |
| 73 |
| Cursor Up/Down | go to link above/below | move Cursor Up/Down | |
| 74 |
|----------------|-------------------------|-------------------------| |
| 75 |
| Insert/Delete | scroll page up/down | scroll page up/down | |
| 76 |
|----------------|-------------------------|-------------------------| |
| 77 |
| Ctrl-C | quit textbrowser | quit gt5 | |
| 78 |
'--------------------------------------------------------------------' |
| 79 |
|
| 80 |
Usage |
| 81 |
~~~~~ |
| 82 |
|
| 83 |
Syntax: gt5 [ dir | file | dir file | file file2 ] [options] |
| 84 |
dir the directory you want to check for space used |
| 85 |
file/file2 existing du-logs (du -akx $DIR #gz/bz2/plain) |
| 86 |
--cut-at float don't show files below 'float'% of its parent, |
| 87 |
default is 0.1, use values between 0.01 and 30 |
| 88 |
--diff-dir d use dir d to store diffs between runs [~/.gt5-diffs] |
| 89 |
--discard do not save this one for diffs, discard it |
| 90 |
--link-files insert links to files for direct access |
| 91 |
--max-depth i ignore anything deeper than i directories [5] |
| 92 |
--max-lines i only consider the i biggest files [10000] |
| 93 |
--no-diffs use this if you really do not want diffs |
| 94 |
--save-as file DEPRECATED, use 'du', see manpage |
| 95 |
--save-state overwrite a previous '--discard' |
| 96 |
--with-mounts also look below mountpoints |
| 97 |
|
| 98 |
Download |
| 99 |
~~~~~~~~ |
| 100 |
Files are hosted on SourceForge.net: (gt5 is released under GPL.) |
| 101 |
http://sourceforge.net/project/showfiles.php?group_id=122114 |
| 102 |
|
| 103 |
Contact |
| 104 |
~~~~~~~ |
| 105 |
If you have any question/suggestion, feel free to contact me via |
| 106 |
http://sourceforge.net/users/tsattler/ |
| 107 |
|