Skip to content

Instantly share code, notes, and snippets.

@zef
Created November 15, 2012 17:46
Show Gist options
  • Save zef/4080042 to your computer and use it in GitHub Desktop.
Save zef/4080042 to your computer and use it in GitHub Desktop.
Shell commands for seeing space taken by .log files and truncating them.
# how much space is being taken up by .log files?
find . -regex '.*\.log' -exec du -hc {} +
# recursively clear all .log files in current directory
find . -regex '.*\.log' -exec cp /dev/null {} \;
# view .log files sorted by file size
find . -regex '.*\.log' -print0 | xargs -0 du | sort -gr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment