Next Previous Contents

8. Tailoring the System

8.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. Additionally, Windows has the infamous registry---one of the worst ideas ever conceived in computer science.

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; they reside in the /etc tree. All configuration can be done editing plain text files. 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 on 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 therein 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 the 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.

Putting this line in your /etc/profile will provide the rough equivalent of PROMPT $P$G:

export PS1="\w\\$ "

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

  • .inputrc: used by bash to define key bindings;
  • .xinitrc: used by startx to initialise X Window System;
  • .fvwmrc: used by the window manager fvwm.
  • .joerc, .jstarrc: used by the editor joe;
  • .jedrc: used by the editor jed;
  • .pinerc: used by the mail reader pine;
  • .Xdefault: used by many X programs.

For all of these and the others you'll come across sooner or later, RMP. Perhaps I could interest you in the Configuration HOWTO, http://www.linuxdoc.org/HOWTO/Config-HOWTO.html?


Next Previous Contents
Copyright © 2010-2024 Platon Technologies, s.r.o.           Home | Man pages | tLDP | Documents | Utilities | About
Design by styleshout