Last active
August 29, 2015 14:14
-
-
Save rpfilomeno/9c6230691c8ed3e5654e to your computer and use it in GitHub Desktop.
Linux Shell Tricks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Find files more than 50MB | |
# cd / | |
# find . -type f -size +50M -exec ls -lh {} \; | awk '{ print $5 ": " $9 }' | sort -k1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grep -rnw 'directory' -e "pattern" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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