delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/05/02/10:42:49

From: mh AT mike DOT franken DOT de (Michael Hirmke)
Subject: Re: color ls for Beta19
2 May 1998 10:42:49 -0700 :
Message-ID: <6t2eu7q4pfB.cygnus.gnu-win32@mike.franken.de>
References: <35488EAE DOT 9231FE7C AT valueweb DOT net>
Mime-Version: 1.0
To: gnu-win32 AT cygnus DOT com

Hi Mark,

>Does anyone know how to set color ls for bash19 (I have already tried
>using export ls --color=always but it doesn't seem to take)?

You first have to configure colors properly:

Create a config file for "dircolors" - for example:

------------------------< snip snip snip >-----------------------------
# colors.in
# Configuration file for the color ls utility

# 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

# Extra command line options for ls go here.
# Basically these ones are:
#  -F = show '/' for dirs, '*' for executables, etc.
#  -T 0 = don't trust tab spacing when formatting ls output.
OPTIONS -F -T 0

# Below, there should be one TERM entry for each termtype that is colorizable
TERM linux
TERM vt100
TERM win32
TERM xterm

# 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;47;30	# global default, although everything should be something.
FILE	00;47;30	# normal file
DIR		00;47;34 	# directory
LINK	00;47;35 	# symbolic link
FIFO	00;47;36	# pipe
SOCK	00;47;36	# socket
BLK		00;40;33	# block device driver
CHR		00;40;37	# character device driver

# This is for files with execute permission:
EXEC 00;47;31 

# 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 00;47;31 # executables (bright green)
..exe 00;47;31
..com 00;47;31
..btm 00;47;31
..bat 00;47;31
..tar 00;47;32 # archives or compressed (bright red)
..tgz 00;47;32
..arj 00;47;32
..taz 00;47;32
..lzh 00;47;32
..zip 00;47;32
..z   00;47;32
..Z   00;47;32
..gz  00;47;32
..jpg 01;47;37 # image formats
..gif 01;47;37
..bmp 01;47;37
..xbm 01;47;37
..xpm 01;47;37
..tif 01;47;37
------------------------< snip snip snip >-----------------------------

Then put the following lines to your .bashrc:

eval `dircolors colors.in`
alias ls='ls --color=tty'

Don't use --color=always - this gives a confusing output for example for
ls | less !

>
>Mark S.

Bye.
Michael.
--
Michael Hirmke           | Telefon +49 (911) 557999
Georg-Strobel-Strasse 81 | FAX     +49 (911) 557664
90489 Nuernberg          | E-Mail  mailto:mh AT mike DOT franken DOT de
                         | WWW     http://minimike.franken.de/
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019