Unix Concepts   «Prev  Next»
Lesson 8Storing your C shell settings
Objective .cshrc file to store alias, history, and prompt definitions.

Storing your C shell Settings

You have been customizing your environment by entering changes at the command line.
But anything you do at the command line applies only to your current session. Once you log out, any aliases you changed, along with the history and prompt definitions, are lost. To make your custom settings permanent, you must store them in a configuration file in your home directory. In the C shell, this file is called .cshrc.

.cshrc file

Every time you log in, UNIX reads your .cshrc file and processes the commands it contains. Typically, this file is where you define aliases and C shell variables. The following MouseOver presents a sample .cshrc file.
It is assumed that the .cshrc file was created during your current UNIX session.
As a result, none of the new settings would be in effect. They would take effect only after your next log in.

Cat command
  1. The cat command displays the contents of the .cshrc file. This file should reside in your home directory
  2. Several aliases have been defined. These aliases will be available at log in and throughout your UNIX session, unless you disable any of them with unalias
  3. The history variable is set to 100. This means that command history will be available, as soon as you log in, for the 100 most recent commands.
  4. The prompt variable defines a prompt, What next?, that will take effect at your next log in, unless you change the prompt at the command line.
  5. Note that your current prompt is unaffected. Even though you defined a different prompt in .cshrc, the new prompt will not take effect until UNIX reads the .cshrc file, at your next login.

sample cshrc File
Configuration files like .cshrc are one place where you can store commands in a file.
Shell Scripts are another place.
In the next lesson, this module will be concluded by reviewing key commands, terms, and concepts you have learned.

Storing CShell Settings - Exercise
Click the Exercise link below to practice creating a .cshrc file.
Storing CShell Settings - Exercise