You are not logged in.

#1 2005-12-18 04:04:36

jellywerker
Member
From: Sunny Seattle
Registered: 2005-04-04
Posts: 286

console colors

I am planning on doing a fresh install (botched mine today when I tried to upgrade, not sure what went wrong, but grub hung before it said "loading stage2" I already tried to fix it, did quite a few things, but it seems gone, so I am working on backing up my stuff atm) anyways...

I want to know how to make my terminal colorful, like on the archie cd, were everything is color coded and such, I think it looks really nice.

Offline

#2 2005-12-18 04:18:53

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Re: console colors

Put:

if [ -f ~/.dir_colors ]; then
    eval `dircolors ~/.dir_colors`
fi

in your ~/.bashrc
Here's my ~/.dir_colors. Feel free to modify it to your liking. smile

# Configuration file for dircolors, a utility to help you set the
# LS_COLORS environment variable used by GNU ls with the --color option.

# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
# slackware version of dircolors) are recognized but ignored.

# Below, there should be one TERM entry for each termtype that is colorizable
TERM linux
TERM linux-c
TERM mach-color
TERM console
TERM con132x25
TERM con132x30
TERM con132x43
TERM con132x60
TERM con80x25
TERM con80x28
TERM con80x30
TERM con80x43
TERM con80x50
TERM con80x60
TERM dtterm
TERM xterm
TERM xterm-color
TERM xterm-debian
TERM rxvt
TERM screen
TERM screen-w
TERM vt100
TERM Eterm

# 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.  (If you set this to 'target' instead of a
        # numerical value, the color is as for the file pointed to.)
FIFO 40;33    # pipe
SOCK 01;35    # socket
DOOR 01;35    # door
BLK 40;33;01    # block device driver
CHR 40;33;01    # character device driver
ORPHAN 40;31;01 # symlink to nonexistent file

# 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 '#')

# If you use DOS-style suffixes, you may want to uncomment the following:
#.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
.bz2 01;31
.deb 01;31
.rpm 01;31
.jar 01;31
.tbz 01;31
.pkg.tar.gz 01;31;40

# image formats
.jpg 01;35
.jpeg 01;35
.gif 01;35
.bmp 01;35
.pbm 01;35
.pgm 01;35
.ppm 01;35
.tga 01;35
.xbm 01;35
.xpm 01;35
.tif 01;35
.tiff 01;35
.png 01;35
.eps 01;35
.fig 01;35

# movie formats
.mov 01;35
.mpg 01;35
.mpeg 01;35
.wmv 01;35
.avi 01;35
.fli 01;35
.gl 01;35
.dl 01;35
.xcf 01;35
.xwd 01;35

# audio formats
.ogg 01;35
.mp3 01;35
.wav 01;35
.wma 01;35
.flac 01;35
.asf 01;35
.ram 01;35

Offline

#3 2005-12-18 04:31:29

jellywerker
Member
From: Sunny Seattle
Registered: 2005-04-04
Posts: 286

Re: console colors

are those like archies? and thanks for the info, i"ll put it too good use big_smile btw, does it work with aterm?

Edit: archie has this for it's .bashrc

alias ls='ls --color=auto'

does that jsut give a default color setup?

Offline

#4 2005-12-18 04:34:27

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: console colors

I'm pretty sure dircolors is installed with bash?? You may have to enable colours in your terminal, for example use TERM=xterm-xfree86 instead of xterm as your terminal.... there's some info in the wiki on this, don't recall the link.

Dusty

Offline

#5 2005-12-18 04:35:55

jellywerker
Member
From: Sunny Seattle
Registered: 2005-04-04
Posts: 286

Re: console colors

huh dusty? that went over my head, so it can only be used with xterm or what?

Offline

#6 2005-12-18 04:55:19

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Re: console colors

It works with aterm (that's what I use). My dir_colors file is based on the example posted here: http://bugs.archlinux.org/task/1839

I use this alias:
alias ls='ls -hp --time-style=locale --color'
I *think* that if there is no ~/.dir_colors, then ls --color won't show any colors.

Offline

#7 2005-12-18 05:17:01

jellywerker
Member
From: Sunny Seattle
Registered: 2005-04-04
Posts: 286

Re: console colors

ok, thanks, and btw, can you make and command an alias, or alias's for normal commands, say ex="exit" or something?

Offline

#8 2005-12-18 05:48:59

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Re: console colors

jellywerker wrote:

ok, thanks, and btw, can you make and command an alias, or alias's for normal commands, say ex="exit" or something?

I'm not sure if I understood your question correctly but, yes, you can use alias as a shortcut for commands. If you type

$ alias ex='exit'

then ex will be interpreted as exit. You can also completely change commands:

$ alias date='pwd'
$ date
/home/eric
$ unalias date
$ date
Sun Dec 18 00:42:05 EST 2005

Offline

#9 2005-12-18 05:52:03

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: console colors

Sorry for not explaining, I had to do that from top of my head, as I don't recall much.


I havet his in .bashrc
  alias ls='ls --color'


Dusty

Offline

#10 2005-12-18 05:57:39

jellywerker
Member
From: Sunny Seattle
Registered: 2005-04-04
Posts: 286

Re: console colors

ok, I get it now dusty, and thanks snowman

Offline

#11 2005-12-18 11:43:47

T-Dawg
Forum Fellow
From: Charlotte, NC
Registered: 2005-01-29
Posts: 2,736

Re: console colors

jellywerker wrote:

are those like archies? and thanks for the info, i"ll put it too good use big_smile btw, does it work with aterm?

Edit: archie has this for it's .bashrc

alias ls='ls --color=auto'

does that jsut give a default color setup?

thats just an alias to ls so you can have colored output on the directories and folders. plain old ls wont show colored out put unless you use that switch.

Offline

Board footer

Powered by FluxBB