Previous Next Contents

5. Tayloring the System

5.1 System Initialization 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 several 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. (see below)
/home/your_home/.bashrc         sets your aliases + functions
/home/your_home/.bash_profile   sets environment + starts your progs
/home/your_home/.profile        ditto

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 .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.

5.2 Program Initialization Files

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

.inputrc: used by bash to define keybindings.

.xinitrc: used by startx to initialize X Window System.

.fvwmrc: used by the window manager fvwm. A sample is in: /usr/lib/X11/fvwm/system.fvwmrc

.Xdefault: used by rxvt, a terminal emulator for X, and other programs.

For all of these and the others you'll come across sooner or later, RMP.


Previous Next Contents