Skip to content

Instantly share code, notes, and snippets.

@imvaskii
Created November 17, 2017 10:06
Show Gist options
  • Save imvaskii/8c4184aa1dc18f0b87618241ea5eb4b4 to your computer and use it in GitHub Desktop.
Save imvaskii/8c4184aa1dc18f0b87618241ea5eb4b4 to your computer and use it in GitHub Desktop.
Disk usage on specific path/location -linux/unix
#!/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
@imvaskii
Copy link
Author

-> Save this file in /usr/local/bin/ as diskusage
-> Make it executable: $ chmod +x /usr/local/bin/diskusage
-> Usage: diskusage /usr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment