[Chapter 2] 2.3 What Goes in Shell Setup Files?
Author: Jerry Peek, Tim O'Reilly & Mike Loukides
Date: 1998-08-04T21:31:55Z

#

| Chapter 2 Logging In |

## 2.3 What Goes in Shell Setup Files?

Shell setup files like .login and .profile typically do at least the following:

- Set the search path (8.7).

- Set the terminal type (5.3) and make various terminal settings (5.9, 41.3).

- Set environment variables (6.1) that might be needed by programs or scripts that you typically run.

- Run one or more commands that you want to run whenever you log in. For example, if your system login program doesn't show the message of the day, your setup file can. Many people also like to print an amusing or instructive fortune (3.3).

  You might want to run who (51.4) or uptime (39.7) for information about the system.

In the C shell, the .cshrc file is used to establish settings that will apply to every instance of the C shell, not just the login shell (51.9). For example, you typically want aliases (10.2) to be available in every interactive shell you run.

Even novices can write simple .profile or .login and .cshrc files. The real trick is to make these setup scripts really work for you. Here are some of the things you might want to try:

- Creating a custom prompt (article 7.1).

- Coordinating custom setup files on different machines (article 2.13).

- Making different terminal settings depending on which terminal you're using (article 2.12).

- Seeing the message of the day only when it changes (article 2.15).

- Doing all of the above without making your login take forever (article 2.5).

- TOR

2.2 Shell Setup Files-Which, Where, and Why |  | 2.4 Tip for Changing Account Setup: Keep a Shell Ready