linux-server-tools/dirsize
Ze'ev Schurmann 6d253fd513 Merge remote-tracking branch 'refs/remotes/origin/main' 2023-11-03 20:41:59 +02:00
..
README.md Update 'dirsize/README.md' 2023-10-27 11:06:39 +02:00
dirsize.sh Created makevhost.sh and updated dirsize.sh 2023-11-03 20:40:38 +02:00

README.md

dirsize

This tool will scan the current folder and then calculate the total size of each folder within the current folder. It can take some time depending on the size.

It is very useful when trying to work out what is taking up all the storage capacity on a server.

If you run it in / you will get some errors as some folders have objects that are not files or folders and thus cannot be measured. Just ignore them as they are not critical. Also note that some folders you will need root access to calculate them. Alternatively you can use sudo.

Setup

Make the file executable by using...

chmod +x dirsize.sh

Then either as root copy it to the /usr/bin folder without the .sh extension...

cp dirsize.sh /usr/bin/dirsize

or using sudo

sudo cp dirsize.sh /usr/bin/dirsize

Example usage

root@zeevs:/var# dirsize
4.0K    ./mail
32M     ./spool
139M    ./cache
349M    ./lib
6.2M    ./backups
959M    ./log
4.0K    ./opt
4.0K    ./local
56K     ./tmp