Display Contents in Color


ls --color

In addition to the symbols that are appended to files and folders when you use the -F option, you can also ask your shell to display things in color, which gives an additional way to classify items and tell them apart. Many Linux installs come with colors already enabled for shells, but if yours does not, just use the --color option.

$ ls --color adblock_filters.txt   fixm3u      pix2tn.pl addext                flash.xml   pop_login address_book.csv      getip       procmail 


In this setup, executable files are green, folders are blue, and normal files are black (which is the default color for text in my shell). Table 2.2 gives you the full list of common color associations (but keep in mind that these colors may vary on your particular distro).

Table 2.2. Colors and File Types

Color

Meaning

Default shell text color

Regular file

Green

Executable

Blue

Directory

Magenta

Symbolic link

Yellow

FIFO

Magenta

Socket

Red

Archive (.tar, .zip, .deb, .rpm)

Magenta

Images (.jpg, .gif, .png, .tiff)

Magenta

Audio (.mp3, .ogg, .wav)


Tip

Want to see what colors are mapped to the various kinds of files on your system? Enter dircolors --print-database, and then read the results carefully. You can also use the dircolors command to change those colors as well.


With the combination of --color and -F, you can see at a glance what kinds of files you're working with in a directory. Now we're cookin' with gas!

$ ls -F --color adblock_filters.txt   fixm3u*      pix2tn.pl* addext*               flash.xml*   pop_login* address_book.csv      getip*       procmail/ 




Linux Phrasebook
Linux Phrasebook
ISBN: 0672328380
EAN: 2147483647
Year: 2007
Pages: 288

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net