Prajwal
Prajwal

Reputation: 673

Save the default behavior of aliased command

I have a command in bashrc

alias ls="ls -l"

Now I want the normal behavior of ls(i.e. only file names) I am trying

alias ls_normal="ls"

When I execute ls_normal, it's calling ls, which is ls -l.

So how do I get the default behavior of ls, after I changed it through alias? Is it possible to save it?

Upvotes: 1

Views: 44

Answers (3)

choroba
choroba

Reputation: 241858

Calling \ls, 'ls', "ls", or using the full path to ls all prevent alias expansion.

Upvotes: 3

Amessihel
Amessihel

Reputation: 6384

The best way is to call it with a backslash:

alias ls_normal='\ls'

Upvotes: 2

Peder Klingenberg
Peder Klingenberg

Reputation: 41115

Alias it to a full path:

alias ls_normal="/bin/ls"

Upvotes: 2

Related Questions