color ls in FreeBSD (in the Bash shell)

I’ve found that this setup for color ls in freebsd is pretty useful and easy on the eyes:
Put this inside your .bashrc

# FILE-TYPE =fb
# where f is the foreground color
# b is the background color
# So to setup Directory color blue setup DIR to ex
# Default for all
# Color code (fb)
# a     black
# b     red
# c     green
# d     brown
# e     blue
# f     magenta
# g     cyan
# h     light grey
# A     bold black, usually shows up as dark grey
# B     bold red
# C     bold green
# D     bold brown, usually shows up as yellow
# E     bold blue
# F     bold magenta
# G     bold cyan
# H     bold light grey; looks like bright white
# x     default foreground or background

# search path for cd(1)
# CDPATH=.:$HOME
# Colour code
DIR=Dx
SYM_LINK=Gx
SOCKET=Fx
PIPE=dx
EXE=Cx
BLOCK_SP=Dx
CHAR_SP=Dx
EXE_SUID=hb
EXE_GUID=ad
DIR_STICKY=Ex
DIR_WO_STICKY=Ex
# Want to see fancy ls output? blank to disable it
ENABLE_FANCY="-F"

export LSCOLORS="$DIR$SYM_LINK$SOCKET$PIPE$EXE$BLOCK_SP$CHAR_SP$EXE_SUID$EXE_GUID$DIR_STICKY$DIR_WO_STICKY"

[ "$ENABLE_FANCY" == "-F" ] && alias ls=’ls -GF’ || alias ls=’ls -G’

# now some handy stuff
alias l=’ls’
alias ll=’ls -laFo’
alias lm=’ll|less’

_____

Other Similar Posts
This entry was posted in FreeBSD. Bookmark the permalink.
  • http://bpk.deepdream.org Benjamin Keating

    I found this article through googling “freebsd color bash”. I found it very useful. just a cut and paste and everythign worked great (running FreeBSD 6.0 and bash 3.1.17 – for any future surfers that stumble upon this page.

  • http://bluej100.blogspot.com Braden

    Very helpful. Thank you.

  • Duffy

    Most useful, thanks!

  • Ted

    How do you get color when piping “ls” output?

  • http://jaredlog.com Jared

    That’s not possible.