Terminal.app in color?

033

Registered
I have no color when using ls at all. Is there anyway to turn it on? I've tried ls --color. Same.. just the colors set in terminal preferences.

I have color when I run BitchX, but the ansi characters are messed up. There's a lot of sideways triangles with ? marks in them.

When I ssh to my webserver (redhat 8) ls is in full color.

I've tried http://www.macosxhints.com/article.php?story=20020408225741777 but when I ls .terminfo/v I get file not found. (there's a file called 76 in there)

Any ideas??

Mac OS X 10.2.4
Set to use /usr/bin/login (i've tried /usr/bin/csh)
 
Open terminal. Choose -- from the menu bar, up -- terminal >> window settings >> color. There you can choose the default colors and transparencies, ansi colors etc.

If you want e.g. the prompt color different from the rest of the text, then this could be useful.. It explains how to set e..g prompt colors (and other features for the prompt). (Well - I have red bold prompt and all the other text in plain black, including links, mutt etc.)

For all the ??? and other charachters - you probably have the wrong keymap enabled. You can change it somewhere in terminal menu - (I can't find it right now; it has to be in preferences or somethign like that) - try with the other keymap settings.

Vim (www.vim.org) has more than vi has ~ like the color .. that could be worth trying as well?
 
No I already saw the color prompt post.

All I want is my 'ls' to be colorized. I don't really care if BitchX's ansi characters are messed up.. that's like a 2nd priority. :p
 
You can get color support by building the GNU Fileutils and using its "ls" instead of the default.

curl -O http://ftp.gnu.org/pub/gnu/fileutils/fileutils-4.1.tar.gz
gnutar xzf fileutils-4.1.tar.gz
cd fileutils-4.1/
./configure
make

If you want all the utilities, do the "sudo make install". If all you want are the directory listing color capabilities, you could just replace the default "ls" with the new one:

sudo mv /bin/ls /bin/ls.OFF
sudo cp src/ls /bin/ls

To update your man page for ls:

sudo mv /usr/share/man/man1/ls.1 /usr/share/man/man1/ls.OFF.1
sudo cp man/ls.1 /usr/share/man/man1/ls.1

You could add an alias to your ".login" file

echo 'alias ls "ls --color" ' >> .login

Bash does not provide ls with color support.
 
"ls --color"

The color codes are in the LS_COLORS shell variable. If you want to customize the colors, you need to set this variable, and assign some filetypes and colors to it. The dircolors command simply executes the following command:

setenv LS_COLORS 'no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:eek:r=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jpg=01;35:*.png=01;35:*.gif=01;35:*.bmp=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.png=01;35:*.mpg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:'

(without line breaks)


This is from a Linux guide for setting ls colors and could be useful too:

LS_COLORS
The format of this variable is reminiscent of the termcap(5) file format; a
colon-separated list of expressions of the form "xx=string", where "xx" is a
two-character variable name. The variables with their associated defaults are:

no - 0 - Normal (non-filename) text
fi - 0 - Regular file
di - 01;34 - Directory
ln - 01;36 - Symbolic link
pi - 33 - Named pipe (FIFO)
so - 01;35 - Socket
bd - 01;33 - Block device
cd - 01;32 - Character device
ex - 01;32 - Executable file
mi - (none) - Missing file (defaults to fi)
or - (none) - Orphaned symbolic link (defaults to ln)
lc - ^[[ - Left code
rc - m - Right code
ec - (none) - End code (replaces lc+no+rc)

You need to include only the variables you want to change from the default.

File names can also be colorized based on filename extension. This is specified
in the LS_COLORS variable using the syntax "*ext=string". For example, using
ISO 6429 codes, to color all C-language source files blue you would specify
"*.c=34". This would color all files ending in .c in blue (34) color.

Control characters can be written either in C-style-escaped notation, or in
stty-like ^-notation. The C-style notation adds ^[ for Escape, \_ for a normal
space character, and ? for Delete. In addition, the ^[ escape character can be
used to override the default interpretation of ^[, ^, : and =.

Each file will be written as <lc> <color-code> <rc> <filename> <ec>. If the <ec>
code is undefined, the sequence <lc> <no> <rc> will be used instead. This is
generally more convenient to use, but less general. The left, right and end
codes are provided so you don't have to type common parts over and over again
and to support weird terminals; you will generally not need to change them at
all unless your terminal does not use ISO 6429 color sequences but a different
system.

If your terminal does use ISO 6429 color codes, you can compose the type codes
(i.e., all except the lc, rc, and ec codes) from numerical commands separated by
semicolons. The most common commands are:

0 - to restore default color
1 - for brighter colors (i.e. text in bold)
4 - for underlined text
5 - for flashing text (really annoying; never recommended)
7 - for reverse field
8 - for hidden field (where did those files go?)
30 - for black foreground
31 - for red foreground
32 - for green foreground
33 - for yellow (or brown) foreground
34 - for blue foreground
35 - for purple foreground
36 - for cyan foreground
37 - for white (or gray) foreground
40 - for black background
41 - for red background
42 - for green background
43 - for yellow (or brown) background
44 - for blue background
45 - for purple background
46 - for cyan background
47 - for white (or gray) background
Not all commands will work on all systems or display devices.

A few terminal programs do not recognize the default end code properly. If all
text gets colorized after you do a directory listing, try changing the no and fi
codes from 0 to the numerical codes for your standard fore- and background
colors.
 
I compiled gnu ls.. and set the ls_colors and now ls --colors works.


Only thing left is .login doesn't get read...

I have the following inside .login:

alias ls "ls --color"
 
Nevermind.. I moved it into .tcshrc and it worked.

One weird thing I noted... when I put set prompt or alias commands after the LS_COLORS command.. they wouldn't work. I put them before and it works fine. WEIRD... I now have a color ls, color prompt...... yay! :) Thanks for your help.
 
Back
Top