Next Previous Contents

7. Tailoring the System

7.1 System Initialisation Files

Two important files under DOS are AUTOEXEC.BAT and CONFIG.SYS, which are used at boot time to initialise the system, set some environment variables like PATH and FILES, and possibly launch a program or batch file. Under Linux there are lots of initialisation files, some of which you had better not tamper with until you know exactly what you are doing. I'll tell you what the most important are, anyway:

FILES                                   NOTES

/etc/inittab                            don't touch for now!
/etc/rc.d/*                             ditto

If all you need is setting the $PATH and other environment variables, or you want to change the login messages or automatically launch a program after the login, have a look at the following files:

FILES                                   NOTES

/etc/issue                              sets pre-login message
/etc/motd                               sets post-login message
/etc/profile                            sets $PATH and other variables, etc.
/etc/bashrc                             sets aliases and functions, etc.
/home/your_home/.bashrc                 sets your aliases + functions
/home/your_home/.bash_profile   or 
/home/your_home/.profile                sets environment + starts your progs

If the latter file exists (note that it is a hidden file), it will be read after the login and the commands in it will be executed.

Example---look at this .bash_profile:


# I am a comment
echo Environment:
printenv | less   # equivalent of command SET under DOS
alias d='ls -l'   # easy to understand what an alias is
alias up='cd ..'
echo "I remind you that the path is "$PATH
echo "Today is `date`"  # use the output of command 'date'
echo "Have a good day, "$LOGNAME
# The following is a "shell function"
ctgz() # List the contents of a .tar.gz archive.
{
  for file in $*
  do
    gzip -dc ${file} | tar tf -
  done
}         
# end of .profile

$PATH and $LOGNAME, you guessed right, are environment variables. There are many others to play with; for instance, RMP for apps like less or bash.

7.2 Program Initialisation Files

Under Linux, virtually everything can be tailored to your needs. Most programs have one or more initialisation files you can fiddle with, often as a .prognamerc in your home dir. The first ones you'll want to modify are:

For all of these and the others you'll come across sooner or later, RMP. As a final note, let me suggest that you check out the Configuration HOWTO on http://sunsite.unc.edu/mdw/HOWTO/Config-HOWTO.html .


Next Previous Contents