Book HomeRunning LinuxSearch this book

4.15. Startup Files

Configuration is a strong element of Unix. This probably stems from two traits commonly found in hackers: they want total control over their environment, and they strive to minimize the number of keystrokes and other hand movements they have to perform. So all the major utilities on Unix--editors, mailers, debuggers, X Window System clients--provide files that let you override their default behaviors in a bewildering number of ways. Many of these files have names ending in rc which means resource configuration.

Startup files are usually in your home directory. Their names begin with a period, which keeps the ls command from displaying them under normal circumstances. None of the files are required; all the affected programs are smart enough to use defaults when the file does not exist. But everyone finds it useful to have the startup files. Here are some common ones:

.bashrc

For the bash shell. The file is a shell script, which means it can contain commands and other programming constructs. Here's a very short startup file that might have been placed in your home directory by the tool that created your account:

PS1='\u$'	# The prompt contains the user's login name.

HISTSIZE=50	# Save 50 commands for when the user presses the up arrow.

# All the directories to search for commands.
PATH=/usr/local/bin:/usr/bin:/bin:/usr/bin/X11

# To prevent the user from accidentally ending a login session,
# disable Ctrl-D as a way to exit.
IGNOREEOF=1

stty erase "^H"	# Make sure the backspace key erases.

.bash_profile

For the bash shell. Another shell script. The difference between this script and .bashrc is that .bash_profile runs only when you log in. It was originally designed so you could separate interactive shells from those run by background processors like cron (discussed in Chapter 8, "Other Administrative Tasks"). But it is not too useful on modern computers with the X Window System, because when you open a new xterm window, only .bashrc runs. If you start up a window with the command xterm -ls, it will run .bash_profile, too.

.cshrc

For the C shell or tcsh. The file is a shell script using C shell constructs.

.login

For the C shell or tcsh. The file is a shell script, using C shell constructs. Like .bash_profile in the bash shell, this runs only when you log in. Here are some commands you might find in .cshrc or .login:

set prompt='% '	# Simple % for prompt.

set history=50	# Save 50 commands for when the user presses the up arrow.

# All the directories to search for commands.
set path=(/usr/local/bin /usr/bin /bin /usr/bin/X11)

# To prevent the user from accidentally ending a login session,
# disable Ctrl-D as a way to exit.
set ignoreeof

stty erase "^H"	# Make sure the backspace key erases.

.emacs

For the Emacs editor. Consists of LISP functions. See the section "Section 9.2.8, "Tailoring Emacs"" in Chapter 9, "Editors, Text Tools, Graphics, and Printing".

.exrc

For the vi editor (also known as ex). Each line is an editor command. See the section "Section 9.1.12, "Extending vi"" in Chapter 9, "Editors, Text Tools, Graphics, and Printing".

.fvwm2rc

For the fvwm2 window manager. Consists of special commands interpreted by fvwm2. A sample file is shown in the section "Section 11.2.1, "Configuring fvwm"" in Chapter 10, "Installing the X Window System".

.twmrc

For the twm window manager. Consists of special commands interpreted by twm.

.newsrc

For news readers. Contains a list of all newsgroups offered at the site.

.Xdefaults

For programs using the X Window System. Each line specifies a resource (usually the name of a program and some property of that program) along with the value that resource should take. This file is described in the section "Section 11.1.2, "The X Resource Database"" in Chapter 10, "Installing the X Window System".

.xinitrc

For the X Window System. Consists of shell commands that run whenever you log into an X session. See the section "Section 11.1, "Basics of X Customization"" in Chapter 10, "Installing the X Window System" for details on using this file.



Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.

This HTML Help has been published using the chm2web software.