Because I'm lazy.... any time I want to use grep, I want it to be grep -n --colour. Is there a way to permanantly map this?
In your $HOME/.bashrc file, add:
This will work with
Update: GREP_OPTIONS is deprecated from grep 2.21 on and if you use this solution you will see the following warning:
Edit ~/.bash_aliases Add a line that says:
~/.bash_aliases is automatically included by ~/.bashrc if it exists
you can modify the file .bashrc located in your home directory defining an alias, which will override any default setting:
alias grep='grep -n --color'
after the change close and open the terminal again because the file is read only when you open the terminal.
If you take a look on the file .bashrc you will found more default aliases like:
alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF'
Create a script in addition to an alias mentioned in the other answers. An alias by itself won't always work, and a script layer is fast enough for human readable output anyways.
Choose a short name, like
Place it in your path, say
I'm still not so happy, I too wanted grep to always color when stdout to a terminal without selectively typing cgrep.