<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html40/loose.dtd"> <HTML> <!-- Created on August, 9 2002 by texi2html 1.65 --> <!-- Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author) Karl Berry <karl@freefriends.org> Olaf Bachmann <obachman@mathematik.uni-kl.de> and many others. Maintained by: Olaf Bachmann <obachman@mathematik.uni-kl.de> Send bugs and suggestions to <texi2html@mathematik.uni-kl.de> --> <HEAD> <TITLE>zsh: Files</TITLE> <META NAME="description" CONTENT="zsh: Files"> <META NAME="keywords" CONTENT="zsh: Files"> <META NAME="resource-type" CONTENT="document"> <META NAME="distribution" CONTENT="global"> <META NAME="Generator" CONTENT="texi2html 1.65"> </HEAD> <BODY LANG="en" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000"> <A NAME="SEC15"></A> <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="zsh_3.html#SEC14"> < </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="zsh_4.html#SEC16"> > </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="zsh_3.html#SEC11"> << </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="zsh.html#SEC_Top"> Up </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="zsh_5.html#SEC18"> >> </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="zsh.html#SEC_Top">Top</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="zsh_toc.html#SEC_Contents">Contents</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="zsh_24.html#SEC195">Index</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="zsh_abt.html#SEC_About"> ? </A>]</TD> </TR></TABLE> <H1> 4. Files </H1> <!--docid::SEC15::--> <P> <HR SIZE="6"> <A NAME="SEC16"></A> <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="zsh_4.html#SEC15"> < </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="zsh_4.html#SEC17"> > </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="zsh_4.html#SEC15"> << </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="zsh.html#SEC_Top"> Up </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="zsh_5.html#SEC18"> >> </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="zsh.html#SEC_Top">Top</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="zsh_toc.html#SEC_Contents">Contents</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="zsh_24.html#SEC195">Index</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="zsh_abt.html#SEC_About"> ? </A>]</TD> </TR></TABLE> <H2> 4.1 Startup/Shutdown Files </H2> <!--docid::SEC16::--> <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> <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> <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> <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. </P> <P> <HR SIZE="6"> <A NAME="SEC17"></A> <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="zsh_4.html#SEC16"> < </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="zsh_5.html#SEC18"> > </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="zsh_4.html#SEC15"> << </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="zsh.html#SEC_Top"> Up </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="zsh_5.html#SEC18"> >> </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="zsh.html#SEC_Top">Top</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="zsh_toc.html#SEC_Contents">Contents</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="zsh_24.html#SEC195">Index</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="zsh_abt.html#SEC_About"> ? </A>]</TD> </TR></TABLE> <H2> 4.2 Files </H2> <!--docid::SEC17::--> <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 (<A HREF="zsh_16.html#SEC82">16. 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. <A NAME="Shell Grammar"></A> </P> <P> <HR SIZE="6"> <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="zsh_4.html#SEC15"> << </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="zsh_5.html#SEC18"> >> </A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="zsh.html#SEC_Top">Top</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="zsh_toc.html#SEC_Contents">Contents</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="zsh_24.html#SEC195">Index</A>]</TD> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="zsh_abt.html#SEC_About"> ? </A>]</TD> </TR></TABLE> <BR> <FONT SIZE="-1"> This document was generated by <I>Peter Stephenson</I> on <I>August, 9 2002</I> using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html "><I>texi2html</I></A> </FONT> </BODY> </HTML>