Color-ls Tips

Donnie Barnes, djb@redhat.com V1.0, February 16, 1996

1 Preface

“Red Hat Tips” are documentation meant to help Red Hat users with specific tasks. Some of these documents are for new users, some are for advanced users. Hopefully each document will also be of help for both new and advanced users. If you have contributions to make, please send them to tech-sup@redhat.com. If you have changes that need to be made to individual Tips, send them to the author of that document.

2 Introduction

Some Linux distributions include, by default, an ls program that uses colors to indicate directories, executables, etc. Red Hat Linux does not ship this way, but it is easy to set up. This Tip describes the simple steps you need to take to use color ls.

3 Installing the color-ls RPM

First, check to see if you have color-ls installed:

     rpm -q color-ls

If rpm reports that color-ls is not installed, you’ll need to install it from your CD-ROM in the RedHat/RPMS directory, or download it from ftp://ftp.redhat.com. Install it with:

     rpm -ivh color-ls-3.12.0.3-2.i386.rpm

(or with whatever the name of the rpm file is).

4 Initializing Color ls

At your shell prompt (this should work for bash and csh/tcsh):

     eval `dircolors`

(Use backquotes around dircolors, not forward quotes.) From then on, if you are on the console, using rxvt or using xterm-color, when you type ‘ls’ your listing will be in color according to file type.

5 Making Color ls the Default

Making color-ls the default for you or your machine is easy. If you just want color-ls to be the default for you, put:

     eval `dircolors`

(Use backquotes around dircolors, not forward quotes.) in your HOME/.bashrcifyouusebashandyourHOME/.cshrc if you use csh/tcsh. If you want color-ls to be the default for everyone on your machine, put:

     eval `dircolors`

(Use backquotes around dircolors, not forward quotes.) in your /etc/bashrc for bash and /etc/csh.cshrc for csh/tcsh.

6 Further Reading

For complete details, read the color-ls and dircolors man pages.

7 Copyright Notice

This document is Copyright (C) 1996 by Red Hat Software. Redistribution of this document is permitted as long as the content remains completely intact and unchanged. In other words, you may reformat and reprint or redistribute only.