Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My ls command is aliased to have certain options automatically applied, including --classify (same as -F) Normally this is fine and I don't want to screw around with my .bashrc file.

Just this one time, I want to turn off --classify but don't see how even after reading the info page and some googling. There's no --classify=none or --classify=off or --no-classify or anything else I could guess.

This is on Red Hat linux in a bash shell.

share|improve this question
    
Check to see if you specified an alias for ls in your .profile ? Perhaps you set alias ls="ls --classify" in there. – rlb.usa Dec 9 '10 at 22:36
up vote 5 down vote accepted

You can turn off --classify selectively by using --indicator-style=none:

$ alias  lc='ls --classify --color=auto'
$ lc -ld foo bar baz
drwxr-xr-x 6 user group  4096 2010-07-19 09:09 foo/
-rwxr--r-- 1 user group 19035 2010-09-30 17:39 bar*
-rw-r--r-- 1 user group    26 2010-11-29 00:44 baz
$ lc -ld --indicator-style=none foo bar baz
drwxr-xr-x 6 user group  4096 2010-07-19 09:09 foo
-rwxr--r-- 1 user group 19035 2010-09-30 17:39 bar
-rw-r--r-- 1 user group    26 2010-11-29 00:44 baz
share|improve this answer
    
Where Unix is, there is always a clean solution: Thanks for providing it! – Eureka Dec 10 '10 at 17:25
    
Changed this to the best answer, the one true way. The backslash or single-quotes does work, but remove all the options in the alias, some of which I continue to want. This --indicator-style option, assuming I will remember it, neatly turns off just the one thing I want off. Very nice! – DarenW Dec 17 '10 at 2:10

After defining an alias, it remains possible to ask bash to use the unaliased command when necessary, using one of the following syntaxes:

$ 'ls'
$ \ls 

Others tips (howto remove it, etc) about the alias command are available in the dedicated "alias" Wikipedia article.

share|improve this answer
    
This solves my immediate problem, thanks! But it would still be nice to know how to turn off only one of several options set by the alias. – DarenW Dec 9 '10 at 22:58
    
If you know that the ls command is an alias, you can remove unwanted option temporarly by dynamicaly generating the "cleaned" ls command using the return of a sed: $(alias ls | cut -f2 -d'=' | sed 's/-l//') myrep to remove a -l, for example. – Eureka Dec 10 '10 at 9:24

You can temporarily disable aliases by using a \ with the command.

http://www.cyberciti.biz/faq/bash-shell-temporarily-disable-an-alias/

share|improve this answer

You could re-alias it with whatever options you want, and it would be reset to whatever is in your .bashrc file on your next session.

share|improve this answer
    
I don't want the one-time (or three-time, since I make mistakes) modification to the options to last beyond the immediate use. – DarenW Dec 17 '10 at 2:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .