Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'color ls and OSX 10.2' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
color ls and OSX 10.2
Authored by: solomone on Nov 16, '02 02:51:44AM
    This worked great!

I tested it first on a dummy machine that I
use for testing and that I wasn't worried about if it blew up but this was

awesome. Mind you I use bash instead of tcsh and I added the following color
instructions to my /etc/profile


LS_COLORS='no=0:fi=36;1:di=31;1:ln=4;33:ex=33;1:*.jpg=35;1:*.jpeg=35;1:*.gif=35;1:*.JPG=35;1:*.JPEG=35;1:*.GIF=35;1:*.gz=34;1:*.tgz=32;1:*.tar.gz=32;1:*.hqx=32;1:*.rpm=33;1'

and the following instruction to my home directory .profile file
alias ls='ls -aF --color=always'
the arguments a and F are not necessary to turn on the color but without it you
will need to add --color at the end of every ls command you enter at the
command line. truly a pain in the ass if you don't add the alias to your
personal .profile file.

[ Reply to This | # ]

color ls and OSX 10.2
Authored by: czar on Oct 11, '03 09:56:24PM
And now for something completely similar Of course, one wants to use it with the installed (default) shell, tcsh, so, I made it system wide.
cd /etc
sudo pico csh.login
You're now editing the csh.login file, this is the system wide file, I also put system wide aliases in here. add the lines:
setenv LS_COLORS "no=0:fi=36;1:di=31;1:ln=4;33:ex=33;1:*.jpg=35;1:*.jpeg=35;1:*.
gif=35;1:*.JPG=35;1:*.JPEG=35;1:*.GIF=35;1:*.gz=34;1:*.tgz=32;1:*.tar.gz=32;1:*.
hqx=32;1:*.rpm=33;1"
alias ls "ls -aFl --color=always"
Note, the setenv LS_COLORS is all one line and ends in a double quote (") I downloaded and installed the modified ls color from earlier in the thread, then, I recalled I had already installed it so, oh well, I did twice the work :). anyways, looks kinda cool with solomon's suggestions, he did most of the work, thanks! -Scott PS Does anyone know if the more command can be made to not kill the color sequences, I've an alias as follows:
alias lsm "ls -aFl | more"
and modified it to read
alias lsm "ls -aFl --color=always | more"
I also tried it w/o the --color=always because the alias to redefine ls is right above it, same result as shown below. When I run the command, I get an icky output (here's a few lines):
ESC[0mtotal 8064
drwxr-xr-x   43 czar     admin        1462 Aug  4 14:30 ESC[31;1m.ESC[0m/
drwxr-xr-x   35 czar     admin        1190 Oct  4 22:06 ESC[31;1m..ESC[0m/
-rwxr-xr-x    1 czar     admin        6148 Aug  4 14:30 ESC[33;1m.DS_StoreESC[0m
*
-rw-r--r--    1 czar     admin      195126 Jun  1 13:06 ESC[35;1m1stboardwalk.jp
gESC[0m
Is this correctable so the output comes out colored as expected? Ideas?

[ Reply to This | # ]