linux-server-tools/dirsize/README.md

44 lines
999 B
Markdown

# 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
```