.profile file

The .profile file is present in your home ($HOME) directory and lets you customize your individual working environment.

Because the .profile file is hidden, use the ls -a command to list it.

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 your individual profile that overrides the variables set in the /etc/profile file. The .profile file is often used to set exported environment variables and terminal modes. You can customize your environment by modifying the .profile file. Use the .profile file to control the following defaults:

  • Shells to open
  • Prompt appearance
  • Keyboard sound
The following example is a typical .profile file:
export PATH epath

This example has defined two path variables (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 /etc/profile file) to determine login shell variables. You can also customize other shell environments. For example, use the .cshrc file and .kshrc file to customize a C shell and a Korn shell, respectively, when each type of shell is started.