Here’s another change I automatically make when installing a new Linux Ubuntu Server.
I’m using Bash prompt, and that’s the standard prompt for all Debian (Ubuntu, Mint, etc…) installations, so the chances are that you are using Bash too.
The standard default color scheme for Linux directory listings (when you type in ls at the linux prompt) is hard to read. If you’re using putty on a Windows machine to connect to a linux server, the color scheme is dreadful. The deep blue is simply illegible for me.
Change the color scheme with a one line change to your bash prompt settings file.
Step One: Backup your bash settings file
From a command prompt at your home directory.
sudo cp .bashrc .bashrc-bkup
Note: If you aren’t sure what directory you are in, type in pwd (present working directory), or simply type in cd and enter, and you’ll be taken to your home directory.
Step Two: Edit your bash prompt settings file
Open the file for edit. I use vim, but you can use any editor that you’re familiar with.
sudo vi .bashrc
add a line at the end of the file
type G in vim to go the end of the file, and then i to insert a row.
LS_COLORS=$LS_COLORS:'di=1;33:' ; export LS_COLORS
The command above changes the color of directories to bold yellow. See the notes section below with other color options.
Save the file. In vim,
Step Three – Reload Bash and Test
To reload bash, type
then try ls -lhat in your favorite directory. If you like the scheme, you’re done! If not, rinse and repeat…
Here’s a list of color codes that you can use instead of yellow. Simply replace 1,33 in the line above with your preferred color.
The First number is for attribute:
0 = Default color
1 = Bold
4 = Underlined
5 = Flashing text (yich)
40 = black background
The Second number is for the text color – Here are some popular choices:
31 = Red
32 = Green
33 = Yellow
34 = Blue
35 = Purple
36 = Cyan
37 = Grey
91 = Light red
92 = Light green
94 = Light blue
95 = Light purple