profile File Format
Purpose
Sets the user environment at login time.
Description
The $HOME/.profile file contains commands that the system executes when you log in. The .profile also provides variable profile assignments that the system sets and exports into the environment. The /etc/profile file contains commands run by all users at login.
After the login program adds the LOGNAME (login name) and HOME (login directory) variables to the environment, the commands in
the $HOME/.profile file are executed, if the file is present.
The .profile file contains the individual user profile that
overrides the variables set in the profile file and customizes
the user-environment profile variables set in the /etc/profile file. The .profile file is often used to set exported environment
variables and terminal modes. The person who customizes the system
can use the mkuser command to set default .profile files
in each user home directory. Users can tailor their environment as
desired by modifying their .profile file.
Note: The $HOME/.profile file is used to set environments for the Bourne and Korn shells.
An equivalent environment for the C shell is the $HOME/.cshrc file.
Examples
The following example is typical of an /etc/profile file:
#Set file creation mask unmask 022
#Tell me when new mail arrives
MAIL=/usr/mail/$LOGNAME
#Add my /bin directory to the shell
search sequence
PATH=/usr/bin:/usr/sbin:/etc::
#Set terminal type
TERM=lft
#Make some environment variables global
export MAIL PATH TERM
Files
Item | Description |
---|---|
/etc/profile | Contains profile variables. |