I was using df -h to print out human readable disk usage. I would like to figure out what is taking up so much space. For instance, is there a way to pipe this command so that it prints out files that are larger than 1GB in size? Other ideas?
Thanks
You may want to try the
ncdu
utility found at: http://dev.yorhel.nl/ncduIt will quicky sum the contents of a filesystem or directory tree and print the results, sorted by size. It's a really nice way to drill-down interactively and see what's consuming drive space.
Additionally, it can be faster than some
du
combinations.The typical output looks like:
I use this one a lot.
It can take a while to run, but it'll tell you where the disk space is being used.
You can use the find command. Example:
I myself use
this returns amount of space used by a directory and its subdirectories up to 4 deep,
sort -n
will put the largest last.New versions of
sort
can handle "human-readable" sizes, so one can use much more readableWith human readable sizes:
Recursively search for big files in one directory
As I haved to determine what is taking up so much space? a lot of time, I wrote this little script in order to search for big occupation on a specific device (without argument, this will browse current directory, searching for >256Mb directory entries):
Sample of use:
Little check:
Nota: using
-b
instead of-k
telldu
to sumarize only used bytes, but not effective reserved space (by block of 512 bytes). For working about blocs size, you have to change linedu -xbs ...
bydu -xks
, suppressb
in_a=(K M G T P)
and divide argument size by 1024.... There is a modified version (I will keep for myself) using blocks sizes by default, but accepting
-b
as first argument for bytes calculation:Edit: New version
After some work about, there is a newer version a lot quicker and with output sorted in descending size order:
To display the biggest top-20 directories in the current folder, use the following one-liner:
or:
For the top-20 biggest files in the current directory (recursively):
or with human readable sizes:
So these aliases are useful to have in your rc files (every time when you need it):