1

I am looking for a shell script for Ubuntu Server that lists the disk usage of directories in a decreasing order. It should not list subfolders (recursively). The behaviour should be similar to the Treesize program on Windows and should be in a human readable format. The disk space of files which are not in a folder can be grouped together as one value. For example:

4G software 2G terry 500M thomas 50M Files 

Or, should I just use ncdu? https://packages.ubuntu.com/search?searchon=sourcenames&keywords=ncdu

1 Answer 1

2

This handy one-liner worked in root's directory on one of my servers.

root@server:~# du -h --max-depth=1 | sort -hr 29M . 19M ./.cache 48K ./.ssh 24K ./.ssh.bkup 16K ./.local 12K ./scripts 12K ./.dbus 12K ./.config 8.0K ./.synaptic 8.0K ./.hplip 8.0K ./.gnupg 4.0K ./.gvfs 4.0K ./.gconf 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.