add treesize disk usage script
This commit is contained in:
parent
23d5fc6e4d
commit
1c7a253553
1 changed files with 15 additions and 0 deletions
15
treesize.sh
Executable file
15
treesize.sh
Executable file
|
|
@ -0,0 +1,15 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
'
|
||||||
Loading…
Add table
Add a link
Reference in a new issue