15.1 Initialization Files 
15.1.1 Features of initialization files
Initialization files contain a series of commands and variable settings that are executed when a shell is started. These files customize the environment for the system and the user. These files are not executable but are read by the shell when the user logs in to customize their environment. There are two levels of initialization files. The first level is system-wide. System initialization files are maintained by a system administrator and reside in the /etc directory. The second level is user-specific initialization files that reside in a user's home directory.

In Chapter 14, we introduced a variable as a place holder for information used for customizing the shell like PS1 for customizing your Korn shell prompt. Variables also contain information required by other processes so they function properly and are either available to only the current shell (local variable) or recognized in any shell or subshell (global or environment variable).

Varibles are either pre-defined (and typically global) and set automatically when you login or set by the user. When a predefined global variable is placed in one of the system-wide initialization files, it is recognized in any shell or subshell. Users can customize many of these variables for their own environment by placing them in the initialization files in their home directory. To make the customizations available to all subsequent shells, the variable must be exported. Each shell uses variables common to all shells and others that are shell specific.

Unlike variables, commands (like aliases) cannot be exported (made available to all subshells). If commands are to be available in a subshell, they must be placed in a secondary initialization file that is read each time a subshell is opened. Figure shows the location of these system-wide and user-specific files in the directory structure. The Korn shell user has two files: .profile and .kshrc (Korn shell run control) in the home directory. The C shell user can have three files: .login, .cshrc (C shell run control) and .log out. These will be discussed later.