Shell configuration file

From FreeBSDwiki
Jump to: navigation, search

Your shell is your environment -- your 'de facto' world -- in a Command Line Interface. You can change how your shell behaves and make it more convinient for your own use (or your user's use, if they're going to be using their shells a lot and you're the admin,) by editing your configuration file. The name of this file will change depending on which shell you're using, and it's important to note that since not all shells have compatible built-in commands, your different config files will not be cross-compatible.

Shell configuration files are often used to change your prompt to something useful; e.g.

dave@kadath:~ $ 

instead of the more austere


You can also define your PATH in your shell, as well as aliases for common typos (or to make commands you use regularly behave in handier ways, but be careful of changing serious commands (ie, rm) with an alias. Red Hat Linux does this by default -- aliasing rm with rm -i, which is handy if you're a new user and aren't expecting rm to delete stuff RIGHT AWAY (which is rm's raison d'etre, of course,) but if you move to another machine that doesn't have this alias, and you're expecting to be asked for could have problems, pilgrim.

The first thing that gets read is /etc/profile, if you've got a .profile, that will get executed next; .bash_profile will get read next if it exists, and any subsequent shell config files should be called from that file. .bashrc will get called from non-interactive shells (ie, non-login shells,) lastly. The easy way to manage everything is to place all your shell customizations in one file and then call it from the other config files.

See also .bashrc, .profile, .cshrc, .shrc, .bash_profile

Personal tools