System Administration Guide
Appendix A, Customizing UNIX system startup

Modifying .profile and .login files

Modifying .profile and .login files

The /etc/profile file sets the default environment for all users of the Bourne and Korn shells, while /etc/cshrc does the same for users of the C shell. The .profile and .login (for C shell users) files in the users' home directories contain commands that initialize the environment for each individual user. When a Bourne or Korn shell user logs in, the shell first executes the commands in /etc/profile and then executes the commands in the .profile file in the user's home directory. When a C shell user logs in, the shell executes the commands in /etc/cshrc and then the commands in the user's .login file in their home directory. (Depending on the login shell, other files may also be read.)

The files contain commands that set various system variables (for example, TERM, PATH, and MAIL). These variables give the system information such as what terminal type is being used, where to look for programs that the user runs, where to look for the user's mailbox, and what keys to expect for the ``kill'' and ``backspace'' functions. For more information about these environment variables, see ``Understanding variables'' in the Operating System User's Guide.

There is one .profile and/or .login file for each user account on the system. The files are placed in the user's home directory when the account is created. Users can modify their own .profile or .login files or allow the system administrator to make modifications. In either case, these files are ordinary text files and can be modified using a text editor. Commands can be added or removed as desired.