The shell uses two types of profile files when you log in to the operating system. It evaluates the commands contained in the files and then runs the commands to set up your system environment. The files have similar functions except that the /etc/profile file controls profile variables for all users on a system whereas the .profile file allows you to customize your own environment.
The following profile and system environment information is provided:
The first file that the operating system uses at login time is the /etc/profile file. This file controls system-wide default variables such as:
The system administrator configures the profile file for all users on the system. Only the system administrator can change this file.
The second file that the operating system uses at login time is the .profile file. The .profile file is present in your home ($HOME) directory and enables you to customize your individual working environment. The .profile file also overrides commands and variables set in the /etc/profile file. Since the .profile file is hidden, use the ls -a command to list it. Use the .profile file to control the following defaults:
The following example shows a typical .profile file:
PATH=/usr/bin:/etc:/home/bin1:/usr/lpp/tps4.0/user:/home/gsc/bin:: epath=/home/gsc/e3: export PATH epath csh
This example has defined two paths (PATH and epath), exported them, and opened a C shell (csh).
You can also use the .profile file (or if it is not present, the profile file) to determine login shell variables. You can also customize other shell environments. For example, use the .chsrc and .kshrc files to tailor a C shell and a Korn shell, respectively, when each type shell is started.