<HTML> <HEAD> <!-- Created by texi2html 1.56k from ./zsh.texi on 26 June 2001 --> <TITLE>zsh - Files</TITLE> </HEAD> <BODY> Go to the <A HREF="zsh_1.html">first</A>, <A HREF="zsh_3.html">previous</A>, <A HREF="zsh_5.html">next</A>, <A HREF="zsh_29.html">last</A> section, <A HREF="zsh_toc.html">table of contents</A>. <P><HR><P> <H1><A NAME="SEC15" HREF="zsh_toc.html#TOC15">Files</A></H1> <P> <H2><A NAME="SEC16" HREF="zsh_toc.html#TOC16">Startup/Shutdown Files</A></H2> <P> <A NAME="IDX14"></A> <A NAME="IDX15"></A> <A NAME="IDX16"></A> <A NAME="IDX17"></A> <A NAME="IDX18"></A> <A NAME="IDX19"></A> Commands are first read from <TT>/etc/zshenv</TT>; this cannot be overridden. Subsequent behaviour is modified by the <TT>RCS</TT> and <TT>GLOBAL_RCS</TT> options; the former affects all startup files, while the second only affects those in the <TT>/etc</TT> directory. If one of the options is unset at any point, any subsequent startup file(s) of the corresponding type will not be read. It is also possible for a file in <TT>$ZDOTDIR</TT> to re-enable <TT>GLOBAL_RCS</TT>. Both <TT>RCS</TT> and <TT>GLOBAL_RCS</TT> are set by default. <P> Commands are then read from <TT>$ZDOTDIR/.zshenv</TT>. <A NAME="IDX20"></A> If the shell is a login shell, commands are read from <TT>/etc/zprofile</TT> and then <TT>$ZDOTDIR/.zprofile</TT>. Then, if the shell is interactive, commands are read from <TT>/etc/zshrc</TT> and then <TT>$ZDOTDIR/.zshrc</TT>. Finally, if the shell is a login shell, <TT>/etc/zlogin</TT> and <TT>$ZDOTDIR/.zlogin</TT> are read. <P> When a login shell exits, the files <TT>$ZDOTDIR/.zlogout</TT> and then <TT>/etc/zlogout</TT> are read. This happens with either an explicit exit via the <TT>exit</TT> or <TT>logout</TT> commands, or an implicit exit by reading end-of-file from the terminal. However, if the shell terminates due to <TT>exec</TT>'ing another process, the logout files are not read. These are also affected by the <TT>RCS</TT> and <TT>GLOBAL_RCS</TT> options. Note also that the <TT>RCS</TT> option affects the saving of history files, i.e. if <TT>RCS</TT> is unset when the shell exits, no history file will be saved. <P> If <TT>ZDOTDIR</TT> is unset, <TT>HOME</TT> is used instead. Those files listed above as being in <TT>/etc</TT> may be in another directory, depending on the installation. <P> As <TT>/etc/zshenv</TT> is run for all instances of zsh, it is important that it be kept as small as possible. In particular, it is a good idea to put code that does not need to be run for every single shell behind a test of the form `<TT>if [[ -o rcs ]]; then ...</TT>' so that it will not be executed when zsh is invoked with the `<TT>-f</TT>' option. <H2><A NAME="SEC17" HREF="zsh_toc.html#TOC17">Files</A></H2> <P> <A NAME="IDX21"></A> <DL COMPACT> <DT><TT>$ZDOTDIR/.zshenv</TT> <DD> <DT><TT>$ZDOTDIR/.zprofile</TT> <DD> <DT><TT>$ZDOTDIR/.zshrc</TT> <DD> <DT><TT>$ZDOTDIR/.zlogin</TT> <DD> <DT><TT>$ZDOTDIR/.zlogout</TT> <DD> <DT><TT>${TMPPREFIX}*</TT> (default is /tmp/zsh*) <DD> <DT><TT>/etc/zshenv</TT> <DD> <DT><TT>/etc/zprofile</TT> <DD> <DT><TT>/etc/zshrc</TT> <DD> <DT><TT>/etc/zlogin</TT> <DD> <DT><TT>/etc/zlogout</TT> (installation-specific - <TT>/etc</TT> is the default) <DD> <DT> <DD> </DL> <P> Any of these files may be pre-compiled with the <TT>zcompile</TT> builtin command (section <A HREF="zsh_16.html#SEC83">Shell Builtin Commands</A>). If a compiled file exists (named for the original file plus the <TT>.zwc</TT> extension) and it is newer than the original file, the compiled file will be used instead. <P><HR><P> Go to the <A HREF="zsh_1.html">first</A>, <A HREF="zsh_3.html">previous</A>, <A HREF="zsh_5.html">next</A>, <A HREF="zsh_29.html">last</A> section, <A HREF="zsh_toc.html">table of contents</A>. </BODY> </HTML>