Tech Support > Operating Systems > Linux / Variants > 'ls'
'ls'
Posted by Ivan Di Prima on March 3rd, 2004


Hi,

is it possible to have colored directories when typing 'ls' from a bash
shell as a user?
you know like when you are logged as root

....if not, I remeber there was one option in the ls command that would
attach a / at the end of each directory name, so that you could
distinguish directories from files, but I cannot find it.

thanks

Posted by Dances With Crows on March 3rd, 2004


On Wed, 03 Mar 2004 21:04:30 GMT, Ivan Di Prima staggered into the Black
Sun and said:
root and the normal users must have different environment/alias
settings. There's nothing specific to root that demands colored ls.
You probably want something like:

alias ls='ls --color=auto'

....in your ~/.alias file. You usually have a line in your ~/.bashrc
that goes

test -e ~/.alias && . ~/.alias

....so all your aliases are always sourced.

"man ls", line 45 or thereabouts. Where were you looking?

--
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see
Brainbench MVP for Linux Admin / mail: TRAP + SPAN don't belong
http://www.brainbench.com / Hire me!
-----------------------------/ http://crow202.dyndns.org/~mhgraham/resume

Posted by Neil Cherry on March 3rd, 2004


On Wed, 03 Mar 2004 21:04:30 GMT, Ivan Di Prima wrote:
--color[=WHEN]
control whether color is used to distinguish file types. WHEN
may be `never', `always', or `auto'

ls --color=always

seems to work (I tried it in rxvt).

--
Linux Home Automation Neil Cherry ncherry@comcast.net
http://home.comcast.net/~ncherry/ (Text only)
http://linuxha.sourceforge.net/ (SourceForge)
http://hcs.sourceforge.net/ (HCS II)

Posted by Nick Landsberg on March 3rd, 2004




Neil Cherry wrote:

ls -F puts a "/" after directories

is that good enough?

--
Ñ
"It is impossible to make anything foolproof because fools are so
ingenious" - A. Bloch