Skip to content

Instantly share code, notes, and snippets.

@rpfilomeno
Last active August 29, 2015 14:14
Show Gist options
  • Save rpfilomeno/9c6230691c8ed3e5654e to your computer and use it in GitHub Desktop.
Save rpfilomeno/9c6230691c8ed3e5654e to your computer and use it in GitHub Desktop.
Linux Shell Tricks
Find files more than 50MB
# cd /
# find . -type f -size +50M -exec ls -lh {} \; | awk '{ print $5 ": " $9 }' | sort -k1
grep -rnw 'directory' -e "pattern"
Grep can remove all the comments and all the blank lines from a configuration file.
grep -v ^# configfile | grep -v ^$
will remove all lines beginning with # (While keeping lines with comments after the setting, as in Whatever = Foo #sets Whatever to Foo)
grep -v ^#
removes all blank lines
grep -v ^$ removes all blank lines.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment