Indiana University
University Information Technology Services
  
What are archived documents?
Login>>
Login

Login is for authorized groups (e.g., UITS, OVPIT, and TCC) that need access to specialized Knowledge Base documents. Otherwise, simply use the Knowledge Base without logging in.

Close

In Unix, what startup and termination files do the various shells use?

Although not a comprehensive list, the following should provide you with a basic understanding of what startup and shutdown files the various Unix shells use.

Note: This information comes from the Unix FAQ, which is posted regularly to the Usenet newsgroups comp.unix.questions and comp.unix.shell. You can obtain it by FTP from rtfm.mit.edu in the /pub/usenet directory, and on the web at: http://www.faqs.org/faqs/unix-faq/faq/

csh

Some versions have systemwide .cshrc and .login files. Each version puts them in different places.

Startup (in this order): Upon termination: Others:
.cshrc (always)
.login (login shells)
.logout (login shells) .history (saves history based on "$savehist")

tcsh

Startup (in this order): Upon termination: Others:
/etc/csh.cshrc (always)
/etc/csh.login (login shells)
.tcshrc (always)
.cshrc (if no .tcshrc file is present)
.login (login shells)
.logout (login shells) .history (saves history based on "$savehist")
.cshdirs (saves directory stack)

sh

Startup (in this order): Upon termination:
/etc/profile (login shells)
.profile (login shells)
Any command or script specified using the command: trap "command" 0

ksh

Startup (in this order): Upon termination:
/etc/profile (login shells)
.profile (login shells)
$ENV (always, if it is set)
Any command or script specified using the command: trap "command" 0

bash

Startup (in this order): Upon termination: Others:
/etc/profile (login shells)
.bash_profile (login shells)
.profile (login if no .bash_profile file is present)
.bashrc (interactive non-login shells)
$ENV (non-interactive shells)
.bash_logout (login shells) .inputrc (readline initialization)

zsh

Startup (in this order): Upon termination:
.zshenv (always, unless the  -f  option is specified)
.zprofile (login shells)
.zshrc (interactive shells, unless the  -f  option is specified)
.zlogin (login shells)
.zlogout (login shells)

rc

Startup (in this order):

.rcrc (login shells)

At Indiana University, for personal or departmental Linux or Unix systems support, see At IU, how do I get support for Linux or Unix?

This is document abdy in domain all.
Last modified on August 22, 2008.

Comments/Questions/Corrections

Use this form to offer suggestions, corrections, and additions to the Knowledge Base. We welcome your input!

If you are affiliated with Indiana University and would like assistance with a specific computing problem, please use the Ask a Consultant form, or contact your campus Support Center.

Contact Information

Note: We will reply to your comment at this address. If your message concerns a problem receiving email, please enter an alternate email address.