Escaping aliases in bash to run a real program


In .bashrc , I have a comment before the alias examples:

# Some example alias instructions
# If these are enabled they will be used instead of any instructions
# they may mask.  For example, alias rm='rm -i' will mask the rm
# application.  To override the alias instruction use a \ before, ie
# \rm will call the real rm not the alias.

The bash Cookbook also talks about this way of running real programs, not aliases.

But man bash does not clearly (specifically) say about this. All I found: "A non-quoted backslash '\' is the Bash escape character. It preserves the literal value of the next character that follows, with the exception of newline."

How does keeping the literal meaning of one character turn off the use of the alias?


Here's the key suggestion:

The first word of each simple command, if unquoted, is checked to see if it has an alias.

\rm , like "rm" or "r"m , is partially escaped. Therefore, alias are not searched. See also:

Scroll to Top