ls
and tree
Edit ~/.bash_profile
or ~/.profile
and add the following two lines:
1export CLICOLOR=1
2export LSCOLORS=ExFxCxDxBxegedabagacad
you can use this if you are using a black background:
1export LSCOLORS=gxBxhxDxfxhxhxhxhxcxcx
LSCOLORS="ExGxBxDxCxEgEdxbxgxcxd"
will emulate the default colouring on the linux ls command.
You can add
1alias ls='ls -Gp'
2alias tree="tree -C"
to your ~/.bash_profile
to ALWAYS get colored ls
and tree
output.
-G
enables colorized output and the -p
adds a slash after each directory. the -C
turns on colorization for the tree command.
The format is as follows: LSCOLORS=ExFxCxDxBxegedabagacad
LSCOLORS needs 11 sets of letters indicating foreground and background colors.
The possible letters to use are:
1# COLORS
2a black
3b red
4c green
5d brown
6e blue
7f magenta
8c cyan
9h light grey
10
11# BOLD CLOLORS
12A block black, usually shows up as dark grey
13B bold red
14C bold green
15D bold brown, usually shows up as yellow
16E bold blue
17F bold magenta
18G bold cyan
19H bold light grey; looks like bright white
20
21# DEFAULT
22x default foreground or background
place | key | foreground | background | meaning |
---|---|---|---|---|
1 | directory | E | x | bold blue with default background for directories |
2 | symlink | F | x | bold magenta with default background for symlinks |
Note: at this point i believe that you can not specify colors based on file extensions (for example, pink for image files extension like .jpeg,.jpg,.png or brown for code file extensions like .html, .js, .php etc.) You can do that in the GNU version of ls though, so i think that one is more powerful. Plus GNU ls has a better color specifying format in the form of LS_COLORS="di=01;90:ow=01;90"
grep
matchesadd the following to ~/.bash_profile
1# Tell grep to highlight matches
2export GREP_OPTIONS='--color=auto'
logfiles
1brew install grc
2echo 'source "`brew --prefix grc`/etc/grc.bashrc"' >> ~/.bash_profile
3source ~/.bash_profile