Skip to content

Instantly share code, notes, and snippets.

@sepehr
Last active November 10, 2015 22:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sepehr/795a3edea9ed10d91a6f to your computer and use it in GitHub Desktop.
Save sepehr/795a3edea9ed10d91a6f to your computer and use it in GitHub Desktop.
Shell: Find & remove files bigger than X
# k: Kilobyte, M: Megabyte, G: Gigabyte
# +: Bigger than, -: Lower than
find . -maxdepth 1 -type f -size +500k -exec rm -f {} \;
# Or better:
find . -maxdepth 1 -type f -size +50M -delete
# Let's have a look first:
find . -maxdepth 1 -type f -size +2G -exec ls -lhS {} \; | awk {print $5 "\t" $9}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment