Shell Customizations

Those that know me will agree, I advocate for shell customizations even more than I advocate for prompt customizations. As such, I will go out of my way to make the shell do what I want it to do. The shell is to do my bidding, not the other way around.

How should a shell be customized?

I recommend that you put your shell customizations in your .bashrc file, rather than your .bash_profile file because your .bashrc file is read in more situations than your .bash_profile file is. - In the testing that I've done, your .bash_profile file is only used when you start an interactive shell as your login shell, i.e. logging in on a virtual console. Where as your .bashrc file is used for just about everything else, including when you open an xterm, or when you ssh in to a system. Further, many distributions are now sourcing the .bashrc file from the .bash_profile file, which means that even if you do log in from the console, your shell customizations in .bashrc will still be used.

Prompt Customization

If you have not done so already, take the time to configure your prompt so that it is useful and provides you the information you need at a glance. You can follow my prompt customizations article for a step by step guide to the prompt that I use which has the following features.

PATH Configuration

The PATH environment variable is extremely important for finding commands to be executed because it specifies 1) which directory to look in for executables, and 2) what order to search the directories in. I like to make sure that at least the following directories are included in my path.

The bin directories have the vast majority of the executables that are frequently used.
The sbin directories have additional system administration specific executables that are frequently used.
I like to have a bin directory in my home directory to keep my personal scripts / executables in.

Command Aliases

Command aliases allow you to further configure your shell to take some of the rougher edges off. For example. I have the "ssh='ssh -q -t'" alias configured for ssh to make it be (more) quite and allocate a TTY. You can even use aliases to automatically run sudo for you when you run a command that requires sudo to correctly run.


Finally, when ever you find your self routinely doing the same thing over and over, write a script to do it. I have written a simple script that will push my profile files over to a new server that I'm supporting. So, now all I have to do is type "pbrc <newServerName>" to push my profile and set up my shell environment.

See also:
Prompt Customizations