Go Back   The macosxhints Forums > OS X Help Requests > UNIX - Newcomers



Reply
 
Thread Tools Rate Thread Display Modes
Old 11-21-2002, 07:40 AM   #1
wanny
Triple-A Player
 
Join Date: Nov 2002
Posts: 59
coloured directories from ls??

Does anyone know how to make directories a different colour from files when using ls in the shell.

I heard that you might have to download something - maybe a different ls? from GNU?
wanny is offline   Reply With Quote
Old 11-21-2002, 11:01 AM   #2
UltraNurd
Major Leaguer
 
Join Date: Sep 2002
Location: Cambridge, MA
Posts: 367
Get the fileutils package through fink, which comes with the gnu ls. Then put an alias line in one of your shell config files with "alias ls 'ls --color=auto'" (without the outer quotes). You will probably need to get color working in terminal as well. Just put this line in your .tcshrc file: "setenv TERM xterm-color" (no quotes).

Brought to you by several hints and posts over the last month or two .
UltraNurd is offline   Reply With Quote
Old 11-21-2002, 11:56 AM   #3
wanny
Triple-A Player
 
Join Date: Nov 2002
Posts: 59
thanks again UltraNurd. I must check back through all those hints - they sounds really useful.

Ill try to check next time first
wanny is offline   Reply With Quote
Old 12-17-2002, 03:15 AM   #4
gatorparrots
Major Leaguer
 
Join Date: Dec 2002
Posts: 441
For those with a black background...

If you are using a dark colored background (such as black) for your Terminal, here is a DIR_COLORS file that will complement it nicely and that is immenently readable (the defaults are very low contrast against a black terminal).

Simply paste it into a text file and save it as '.dir_colors' in your ~ directory; then make sure this line:
eval `dircolors -c ~/.dir_colors`
is in your .tcshrc or .cshrc (whichever is applicable for your configuration).

Code:
# One TERM entry for each termtype that can be coloured
TERM console
TERM xterm
TERM xterm-color
TERM color-xterm
TERM vt100

# EIGHTBIT, followed by '1' for on, '0' for off. (8-bit output)
EIGHTBIT 1

# Attribute codes:
# 00=none 01=bold 04=underscore 05=flash 07=reverse 08=concealed
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white

NORMAL 00 # default
FILE 00 # normal file
DIR 00;33 # directory
LINK 04 # symbolic link
FIFO 44;30 # pipe
SOCK 44;31 # socket
BLK 44;33 # block device driver
CHR 44;33 # character device driver
ORPHAN 01;05;37 # orphaned syminks
MISSING 00 # ... and the files they point to

# This is for files with execute permission:
EXEC 32

# Colour by file extension
# executable
.cmd 32
.exe 32
.com 32
.btm 32
.bat 32
.sh 32
.csh 32
# archive and compressed
.tar 31
.tgz 31
.arj 31
.taz 31
.lzh 31
.zip 31
.z 31
.Z 31
.gz 31
.bz2 31
.bz 31
.tz 31
.rpm 31
.cpio 31
.sit 31
# image
.jpg 36
.jpeg 36
.gif 36
.bmp 36
.xbm 36
.xpm 36
.png 36
.tif 36
.psd 36
# other notable extensions
.html 35
.htm 35
.ws 35
.css 35
gatorparrots is offline   Reply With Quote
Old 12-17-2002, 04:44 AM   #5
thatch
All Star
 
Join Date: Jan 2002
Posts: 534
UltraNurd, you are the man. I've been searching for why I have been unable to get dircolors to work in xterm and you have provided the very simple answer. At the end of my ~/.login:
Code:
source /sw/bin/init.csh
setenv TERM xterm-color
eval `dircolors ~/.dircolors`
Thank you! I wonder why that isn't necessary for the regular terminal.app to get dircolors going? I didn't need the setenv line there and that is what has confused me about that for so long.
thatch is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 10:31 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.