I’ve been disappointed for some time now regarding the output of the ls command. Well curse no more. There are basically two ways of getting this to work:
First one is to install ls through macports. This can be accomplished by doing a
This installs the the GNU variant of sysutils (of which ls is a part of) and overrides the names (the new ls will be called gls). All you have to do is add the following line in your.
The second version is to enable the colours inside the BSD-style ls provided by apple. This is achieved by aliasing ls to ls -G . I found the default colours unusable so I went ahead and defined my own. The colorscheme is controlled by the LSCOLOR environment variable.
There are 11 types of objects that can have colors. These objects are listed in the following order:
- directory
- symbolic link
- socket
- pipe
- executable
- block special
- character special
- executable with setuid bit set
- executable with setgid bit set
- directory writable to others, with sticky bit
- directory writable to others, without sticky bit
For each object you need to define the foreground colour and the background color.
The recognized colours are:
a black
b red
c green
d brown
e blue
f magenta
g cyan
h light grey
A bold black
B bold red
C bold green
D bold brown
E bold blue
F bold magenta
G bold cyan
H bold light grey
x default foreground or background
My choice of colours:
This means: blue foreground, default background dirs, cyan foreground, default background symlinks, …
Comments
Leave a comment