I have searched the internet and websites say that we can edit both the file as per our needs and first .cshrc file is executed and then the .login file.

That is fine but what is the exact difference between the two. Please tell in easy words. Thanks

1 Answer 1


The manual describes what files (t)csh loads when it starts. (T)csh always reads .cshrc. .login is only read if the shell is a login shell, i.e. the first program after logging in. When you type your username and password on a text console, or when you use SSH to log into a remote machine, you get a login shell and .login is read. When you open a terminal in a GUI session, or when a shell runs a script, this isn't a login shell and only .cshrc is read. For more information, see Difference between Login Shell and Non-Login Shell? (which discusses sh-style shells, not csh; the principle is the same but the file names are different and the fact that .cshrc is loaded in scripts is a csh specificity).

.login is the place to define things that should be done at the start of the session, such as setting environment variables. .cshrc is the place to set shell parameters such as aliases, key bindings, etc. Beware that (t)csh loads .cshrc even in scripts.

Note that .login is not executed when you log in at a graphical prompt (unless the GUI session is based on a csh script, but I've never seen that, it would be extremely unusual). What scripts are executed on a graphical login varies but .profile (the sh equivalent of .login) is very common.

Csh was a better interactive shell than others in the 1980s but it hasn't really evolved since the 1990s and has been overtaken by zsh and bash. Don't learn csh now, you're at least 20 years out of date. Bash is pre-installed on virtually all systems that have csh and many more, and zsh is if not pre-installed then at least available as a package.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .