More useful snippets for your ~/.bashrc file to increase the efficiency of your everyday terminal tasks.
This will grep every file found recursively starting from the current directory. Will accept multiple search expressions and will print the results for each search term separately with nice colors. Very useful for searching through large collection of code or other text, especially when searching for multiple things.
1 2 3 4 5 6 7 8 9 10 11
Update: A better option is to use ag (the silver searcher).
Print exit code of the last command
If the last command exited with a non zero return code then the return code and, when applicable, the accompanying signal is printed to the terminal.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Strip colors from output
Pipe the results through this command to strip colors from the output of other commands.