Customizing startup files

Some programs, such as the shell, look for startup files when they start. Startup files are text files that consist of commands and settings.

On most UNIX systems, when you log on to the Korn shell, the shell runs at least two startup files: /etc/profile and $HOME/.profile. These files, called login scripts, include commands for setting up your environment. The C shell runs similar scripts, such as /etc/csh.cshrc and /etc/csh.login, and multiple files in your home directory.

Interix shells work in a similar way, but include additional files that have the .lcl extension. The Korn shell reads /etc/profile, which calls /etc/profile.lcl. The C shell reads /etc/csh.login, which calls /etc/csh.lcl. You should make any local system changes in the .lcl files. These files control settings that affect all users who log on to a shell.

If you want to manage the environment of one user, you can create login scripts in a user's home directory. The Korn shell uses the login script called .profile. Interix provides the /etc/profile.usr file as a template for creating .profile. To use this template, copy /etc/profile.usr to a user's home directory and rename it to .profile. Users can then edit .profile to their liking. To see how to create a home directory, see Create a home directory.

In the C shell, you can customize the environment for individual users by creating the files $HOME/.cshrc, $HOME/.history, $HOME/.login, and $HOME/.cshdirs. The C shell runs all of these files when you log on.

Certain programs, such as as text editors, also use startup files. These startup files are usually stored in your home directory and have file names that begin with a dot (.), such as those in the following table:

Utility Startup file
ex(1) /vi $HOME/.nexrc,$HOME/.exrc
mailx(1) /etc/mailx.rc,$HOME/.profile

The PATH variable

One common modification you can make to startup files is to add directories to the PATH variable. For example, you might want your PATH to point to programs and shell scripts in a directory called bin under your home directory. For examples of how to modify the PATH, see the files profile, profile.lcl and profile.usr in /etc.

The PATH_WINDOWS variable

You can also use startup files to set the PATH_WINDOWS variable, which you can use to look for Windows commands from within an Interix shell. For more information on PATH_WINDOWS, see Starting a Win32 program.

The flip utility

When you create new startup files or modify existing ones, such as profile.lcl, remember that the UNIX text file format is different from MS-DOS. Many Interix subsystem programs, such as csh(1), require startup files to be in POSIX-style format. Lines should end with a line-feed character and not the carriage return/line-feed combination that is found in MS-DOS. If you create startup files with Windows Notepad or MS-DOS Edit, you can convert them to the POSIX format with the following command:

flip -u filename...

The programs ksh(1), make(1), and awk(1) (with the -f option) can read script files in either the Interix or MS-DOS format.