Who rated this post

cancel
Showing results for 
Search instead for 
Did you mean: 
Andrew_Rawlinso
Participant

A good tool to find what is taking up your disk space is "treesize". You can add it to your gateway by following the instructions below:

1. vi /bin/treesize

2. Paste everything between the hashes below (including the last line with ' on it):

############################
du -k --max-depth=1 | sort -nr | awk '
BEGIN {
split("KB,MB,GB,TB", Units, ",");
}
{
u = 1;
while ($1 >= 1024) {
$1 = $1 / 1024;
u += 1
}
$1 = sprintf("%.1f %s", $1, Units[u]);
print $0;
}
'
############################

3. Save and exit vi:

Esc, followed by ":wq"

4. Change permissions so you can run treesize:

chmod 777 /bin/treesize

5. Run the tool, eg:

cd /var/log
treesize

2024-06-18_13-48-16.jpg

(1)
Who rated this post