|
|
|||
USING COLORS WITH ls Color-coding output is a useful way to brighten a dreary terminal screen and to quickly identify file types at a glance. Some UNIX variants (such as OpenBSD or FreeBSD) and Linux variants don't use color-coded output for ls by default. However, many do. Knowing how to accomplish the following will allow you to customize your color-coding with ls. The first thing you need to do is set up an alias for ls telling it to use colors. You can do this in ~/.bash_profile or /etc/profile if you use the bash shell in the following way: eval `dircolors --sh /etc/DIR_COLORS`alias ls="ls --color=auto" This is assuming a change to /etc/profile for system-wide color support. The dircolors command will read the file /etc/DIR_COLORS to obtain the codes for different file entries. An example /etc/DIR_COLORS file might look like this: COLOR tty TERM linux NORMAL 00 DIR 01;34 EXEC 01;32 .rpm 01;31 This simple example tells the shell:
To make all files ending in ".rpm" a bold red. |
||||