Created
November 17, 2017 10:06
-
-
Save imvaskii/8c4184aa1dc18f0b87618241ea5eb4b4 to your computer and use it in GitHub Desktop.
Disk usage on specific path/location -linux/unix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Default path is root (/) | |
path="/" | |
# if string is not null | |
if [ -n "$1" ]; then | |
path="$1" | |
fi | |
echo "Scanning $path for disk usage" | |
sudo du -h "$path" | sort -h -r | head -n 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-> Save this file in
/usr/local/bin/
asdiskusage
-> Make it executable:
$ chmod +x /usr/local/bin/diskusage
-> Usage:
diskusage /usr