Colorizing Slack Directories
- 0
- Add a Comment
- No Related Post
Colorizing Slack Directories
I’m not a big fan of colorizing. In fact, I’m quite happy that the fad of colorizing old movies has all but faded to a black and white memory. I have, however, been spoiled by the colorization found in recent commercial Linux distros. With bright greens for executable files, blues for directories, and reds for archives, I’ve found it much easier to identify at a glance the files or directories I’m looking for in a console window. It’s one case where color clearly beats the old black and white.
If you’re following me into Slackland this week, you’ll find a noticeable lack of color in the console window. In movies, that’s nostalgic. In the console it’s boring. Luckily, I’ve got a step-by-step guide for adding referential colors to the console window in a stock Slackware install.
First, you’ll need to change your user to root. su does the trick quite nicely. Then, change directories to /etc.
su
[your root password]
cd /etc
ls
You should find a file in the /etc directory named DIR_COLORS. Take a quick look at it using a read-only version of vi:
view DIR_COLORS
Every line that begins with # is a comment. These are ignored by the system, but serve to provide a roadmap to users of what the programmer had in mind at the time the program was written. There’s some interesting stuff in these comments, and I always recommend that some time is taken in reading them. Anyway, you’ll see some instructions in the comments for changing the default directory and file colors. Feel free to change them, or leave them at the defaults - just so you know you can.
Now, close vi:
:q!
and enter the following command, still as root:
chown 644 ./DIR_COLORS
This makes the file readable by “the world.” It will need to be so in order for you to use it as the reference for your newly colorized console window.
You’ll want to make these colors available right away, so type exit to leave the root user, and enter the command:
evaluate `dircolors /etc/DIR_COLORS`
(Those are backticks, by the way, not quotes. You’ll find it right under the ~ on most keyboards.)
One more tweak and we’re there. You’ll need to edit your .bashrc file. This is a very useful hidden file that resides in your home directory. It’s killer for tweaks. We’ll be adding more to this file as we go along. For now, you can enter the above evaluate statement directly to .bashrc. Make sure you’re in your home directory, then add the line, even if the file is empty.
cd ~/
vi .bashrc
i [remember, this inserts in vi]
evaluate `dircolors /etc/DIR_COLORS`
:wq [write and quit]
Finally, log out of the console using the exit command, then restart it. Enter the ls command when it’s open, and there you go … full color in the console window.
