Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Jan 1996 18:21:18 -0500
From:      Brian Clapper <bmc@telebase.com>
To:        BSD Mailinglisten-User <bsd@birdland.rhein-neckar.de>
Cc:        Donald Burr <d_burr@ix.netcom.com>, Chuck Robey <chuckr@glue.umd.edu>, freebsd-ports@FreeBSD.org
Subject:   Re: linux `ls' port
Message-ID:  <199601102321.SAA00855@telebase.com.>
In-Reply-To: <Pine.BSF.3.91.960111000621.233A-100000@birdland.rhein-neckar.de>
References:  <Pine.BSF.3.91.960109001331.241A-100000@ncc-1701-d.starfleet.gov> <Pine.BSF.3.91.960111000621.233A-100000@birdland.rhein-neckar.de>

next in thread | previous in thread | raw e-mail | index | archive | help
>>>>> "BSD" == BSD Mailinglisten-User <bsd@birdland.rhein-neckar.de> writes:


>> > Hmm, how does the linux ls differ from colorls in ports/misc ?
>>
>> It does NOT send colour codes if the stdout is not a tty (i.e. if you're
>> piping through 'more' or doing 'ls > file' then it won't output ugly ANSI
>> seuqneces).  And it's configurable, ie you can set yourself the cololrs
>> that different types of files appear as.

BSD> Unfortunately, mine does... I got the port from Brian's ftp server and
BSD> compiled it. It works (more or less; dirs are green, not blue as I'm
BSD> accustomed to, but it should be possible to change that). Unfortunately
BSD> "ls -lo |less" yields funny looking ANSI-Escape sequences... something
BSD> like

BSD> total 8
BSD> drwxr-xr-x   2 root     wheel         512 Jan  4 21:48 Mail
BSD> drwxr-xr-x   2 root     wheel         512 Jan  4 21:48 News
BSD> drwx------   2 root     wheel         512 Jan 10 23:11 mail

BSD> Any ideas?

You need to pass it the `--color=tty' option.  You can also pre-define a
lot of these options in either /usr/local/etc/DIR_COLORS or ~/.dir_colors,
then use the `dircolors' program to parse that file and set up some
convenient aliases for you.  `dircolors' is built as part of the port.
Check out the man page.  I've enclosed the DIR_COLORS file I use as a
starting point; I probably should have included it in the port.  In any
case, the dircolors man page explains its syntax.
----
Brian Clapper, bmc@telebase.com, http://www.netaxs.com/~bmc/
Man who falls in blast furnace is certain to feel overwrought.

---------- Begin Enclosure
# Configuration file for the color ls utility
# This file goes in the /etc directory, and must be world readable.

# COLOR needs one of these arguments: 'tty' colorizes output to ttys, but not
# pipes. 'all' adds color characters to all output. 'none' shuts colorization
# off.
COLOR tty

# Below, there should be one TERM entry for each termtype that is colorizable
TERM console
TERM con132x25
TERM con132x30
TERM con132x43
TERM con132x60
TERM con80x25
TERM con80x28
TERM con80x30
TERM con80x43
TERM con80x60
TERM xterm
TERM vt100
TERM cons25

OPTIONS -F

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

# Below are the color init strings for the basic file types. A color init
# string consists of one or more of the following numeric codes:
# Attribute codes:
# 00=none 01=bold 04=underscore 05=blink 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       # global default, although everything should be something.
FILE 00         # normal file
DIR 01;34       # directory
LINK 01;36      # symbolic link
FIFO 40;33      # pipe
SOCK 01;35      # socket
BLK 40;33;01    # block device driver
CHR 40;33;01    # character device driver

# This is for files with execute permission:
EXEC 01;32

# List any file extensions like '.gz' or '.tar' that you would like ls
# to colorize below. Put the extension, a space, and the color init string.
# (and any comments you want to add after a '#')
.cmd 01;32 # executables (bright green)
.exe 01;32
.com 01;32
.btm 01;32
.bat 01;32
.tar 01;31 # archives or compressed (bright red)
.tgz 01;31
.arj 01;31
.taz 01;31
.lzh 01;31
.zip 01;31
.z   01;31
.Z   01;31
.gz  01;31
.jpg 01;35 # image formats
.gif 01;35
.bmp 01;35
.xbm 01;35
.xpm 01;35
.a   00;33
.o   00;33

---------- End Enclosure



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199601102321.SAA00855>