Using Sets of Aliases

The more alias definitions your ˜/.cshrc file contains, the longer it takes the shell to start up. On fast machines, the delay won't be much of an issue; however, on slow machines, you may find the delay frustrating. Logins and subshells (started as shell escapes from an editor or mailer, for instance) may take noticeably longer.

If some of your aliases are used only under special circumstances, consider taking them out of ˜/.cshrc to make startup time shorter. For example, if you have aliases that are used only for a particular project, put them in a file called proj-aliases and locate it in the project's top-level directory. Then, when you move into that directory to work on the project, activate the aliases, as follows:

% cd ˜/myproj
% source proj-aliases

(The source command is needed only once per login session.) If you want to be trickier, you can create an alias in ˜/.cshrc that changes into the project directory and automatically reads in the alias definitions:

alias cdproj 'cd ˜/myproj;source proj-aliases'

Get Using csh & tcsh now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.