Skip to content

Instantly share code, notes, and snippets.

@janxkoci
Last active November 15, 2022 10:57
Show Gist options
  • Save janxkoci/29951cfc47b7ed4ad46b981324b3e118 to your computer and use it in GitHub Desktop.
Save janxkoci/29951cfc47b7ed4ad46b981324b3e118 to your computer and use it in GitHub Desktop.
See size of your top 10 largest files and folders.
#!/bin/bash
## Takes path as argument ($1) or uses current path instead (.) if no argument given.
path="${1:-.}"
## Gets size for items in path and reports the top 10 files and folders.
du -sh ${path}/* | sort -rh | head -n ${2:-10}
@janxkoci
Copy link
Author

janxkoci commented Nov 15, 2022

Evgeny uses the following:

# Use this command in your home dir to locate large files:
find . -type f -size +10G | xargs -I {} ls -sh {}

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