how to 'not' execute alias [duplicate]

I have set few aliases in .bashrc file. I need those aliases most of the time, but sometimes I need to run those command without options set in that particular alias.

How to not execute alias command?

0

3 Answers

Run the command with a leading \, an answer in examples: ;)

% ls bar foo % alias ls="ls -laog" % ls total 4292 drwxrwxr-x 4 4329472 Nov 5 15:06 . drwx------ 95 28672 Nov 5 15:15 .. -rw-rw-r-- 1 0 Nov 5 15:06 bar drwxrwxr-x 2 4096 Nov 5 15:06 foo drwxrwxr-x 2 4096 Okt 2 14:29 .foo -rw-rw-r-- 1 191 Feb 25 2015 .htaccess % \ls bar foo 

Slightly longer but also possible:

command ls 
3

You can use shell builtin command to escape aliases (and functions):

command alias_name 

For example:

command ls 

will run /bin/ls binary , not any alias defined as ls.

An alternative is to use quotes:

"alias_name" 

or

'alias_name' 

For example:

"ls" 

or

'ls' 

these again will run the /bin/ls binary, ignoring any alias ls.

5

Alternatively, you could specify full path to command. For instance, my ls command is aliased to ls='ls --color -F'

What one can do is either call /bin/ls or $(which ls) (for those of us who are lazy to type full path).

Example : calling original command with flags $(which ls) -l

2

You Might Also Like