Skip to main content
2 of 3
Added manual quotes.
user avatar
user avatar

Here is where I find grep -rl very useful:

grep -rl alias ~/.bash* ~/.profile /etc/profile /etc/bash.bashrc

will tell you in which file the word alias is used.

Probably in ~/.bashrc and most certainly in ~/.bash_aliases if it exists.


It is however impossible to be absolutely sure that that covers all options. Those files may also call or load any other files. An environment variable like ENV or $BASH_ENV may direct bash to load some other files.

looks for the variable BASH_ENV in the environment, expands its value if it appears there, and uses the expanded value as the name of a file to read and execute.

And aliases may even be defined by setting a variable (emphasis mine):

BASH_ALIASES
An associative array variable whose members correspond to the internal list of aliases as maintained by the alias builtin. Elements added to this array appear in the alias list

user232326