How to turn off --classify option in ls command?

6

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.

DarenW

Posted 2010-12-09T22:17:52.260

Reputation: 1 707

Check to see if you specified an alias for ls in your .profile ? Perhaps you set alias ls="ls --classify" in there. – rlb.usa – 2010-12-09T22:36:04.807

Answers

6

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

Paused until further notice.

Posted 2010-12-09T22:17:52.260

Reputation: 86 075

Where Unix is, there is always a clean solution: Thanks for providing it! – Eureka – 2010-12-10T17:25:23.957

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 – 2010-12-17T02:10:30.267

8

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.

Eureka

Posted 2010-12-09T22:17:52.260

Reputation: 511

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 – 2010-12-09T22:58:12.693

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 – 2010-12-10T09:24:31.973

1

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

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

Michael Burns

Posted 2010-12-09T22:17:52.260

Reputation: 121

0

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.

Snap

Posted 2010-12-09T22:17:52.260

Reputation: 146

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 – 2010-12-17T02:08:31.423