Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I know there is a simple syntax for telling bash not to expand aliases. However, Google is not turning it up and I'm too lazy to read through man bash. Also, the answer should be on this website.

share|improve this question

3 Answers 3

up vote 9 down vote accepted

Put a backslash before the first character.

$ alias ls="echo foo"
$ ls
foo
$ \ls
bin
Desktop
Documents
  ...
share|improve this answer
4  
By the way, this is not a bash-specific feature. It's mandated by POSIX, and works in bash, ksh and zsh amongst others. –  Gilles Oct 16 '10 at 11:40

You can use command shell builtin command. It will execute only commands found in the PATH or shell builtins. It won't execute aliases or shell functions.

Example:

alias ls='ls -l'
$ ls
drwxr-xr-x 3 user user 4096 2010-10-11 13:17 dir1
drwxr-xr-x 3 user user 4096 2010-10-15 15:37 dir2
$ function ls() {
> echo hello
> }
$ ls
hello
$ command ls
dir1  dir2
share|improve this answer

Type shopt -u expand_aliases into the bash shell (the -u switch is for unset). I recommend reading the man page for shopt.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.