Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Unix shell
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Configuration files== Shells read configuration files in various circumstances. These files usually contain commands for the shell and are executed when loaded; they are usually used to set important variables used to find executables, like [[$PATH]], and others that control the behavior and appearance of the shell. The table in this section shows the configuration files for popular shells.<ref>{{cite web|url=http://www.unixnote.com/2010/05/different-unix-shell.html|title=Different UNIX Shells|publisher=unixnote.com|date=2010|access-date=2016-08-21|archive-url=https://web.archive.org/web/20160403120601/http://www.unixnote.com/2010/05/different-unix-shell.html|archive-date=2016-04-03|url-status=dead}}</ref> {| class="wikitable floatleft sortable" style="text-align: center; margin-right: 2em;" |- ! Configuration file ![[Bourne shell|sh]] ![[KornShell|ksh]] ![[C shell|csh]] ![[tcsh]] ![[Bash (Unix shell)|bash]] ![[Z shell|zsh]] |- |style="text-align:left;"|{{mono|/etc/.login}} | | |login |login | | |- |style="text-align:left;"|{{mono|/etc/csh.cshrc}} | | |yes |yes | | |- |style="text-align:left;"|{{mono|/etc/csh.login}} | | |login |login | | |- |style="text-align:left;"|{{mono|~/.tcshrc}} | | | |yes | | |- |style="text-align:left;"|{{mono|~/.cshrc}} | | |yes |yes{{Efn|only if {{mono|~/.tcshrc}} not found}} | | |- |style="text-align:left;"|{{mono|/etc/ksh.kshrc}} | |int. | | | | |- |style="text-align:left;"|{{mono|/etc/sh.shrc}} |int.{{Efn|Newer versions of the Bourne Shell only}} | | | | | |- |style="text-align:left;"|{{mono|$ENV}} (typically {{mono|~/.kshrc}})<ref>SCO Unix Group, [http://unix.harley.com/instructors/timeline.html SCO Unixware 7 documentation, 22 Apr 2004, retrieved 18 Oct 2012].</ref> |int.{{Efn|Available on systems that support the "User Portability Utilities option"; value of the variable must be an ''absolute'' path, and it is ignored "if the user's real and effective user IDs or real and effective group IDs are different."<ref>{{cite web|url=http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_05_03|title=Shell Command Language|work=opengroup.org|access-date=15 June 2015}}</ref>}}{{Efn|{{mono|$ENV}} is {{mono|$HOME/.shrc}} in newer versions of the Bourne Shell}} |int. | | |int.{{Efn|Same behavior as {{mono|sh}}, but only if invoked as {{mono|sh}} (bash 2+) or, since bash 4.2, also if invoked ''explicitly'' in POSIX compatibility mode (with options {{mono|--posix}} or {{mono|-o posix}}).<ref>{{cite web|url=https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html|title=Bash Reference Manual: Bash Startup Files|work=gnu.org|access-date=15 June 2015}}</ref>}} | |- |style="text-align:left;"|{{mono|~/.login}} | | |login |login | | |- |style="text-align:left;"|{{mono|~/.logout}} | | |login |login | | |- |style="text-align:left;"|{{mono|/etc/profile}} |login |login | | |login |login{{Efn|name="zsh profiles"|Only in sh/ksh compatibility mode (when invoked as bash, sh, ksh)}} |- |style="text-align:left;"|{{mono|~/.profile}} |login |login | | |login{{Efn|name="bash profiles"|The first readable file in order of {{mono|~/.bash_profile}}, {{mono|~/.bash_login}} and {{mono|~/.profile}}; and only {{mono|~/.profile}} if invoked as {{mono|sh}} or, as of at least Bash 4.2, if invoked ''explicitly'' in POSIX compatibility mode (with options {{mono|--posix}} or {{mono|-o posix}})}} |login{{Efn|name="zsh profiles"}} |- |style="text-align:left;"|{{mono|~/.bash_profile}} | | | | |login{{Efn|name="bash profiles"}} | |- |style="text-align:left;"|{{mono|~/.bash_login}} | | | | |login{{Efn|name="bash profiles"}} | |- |style="text-align:left;"|{{mono|~/.bash_logout}} | | | | |login | |- |style="text-align:left;"|{{mono|~/.bashrc}} | | | | |int.+n/login | |- |style="text-align:left;"|{{mono|/etc/zshenv}} | | | | | |yes |- |style="text-align:left;"|{{mono|/etc/zprofile}} | | | | | |login |- |style="text-align:left;"|{{mono|/etc/zshrc}} | | | | | |int. |- |style="text-align:left;"|{{mono|/etc/zlogin}} | | | | | |login |- |style="text-align:left;"|{{mono|/etc/zlogout}} | | | | | |login |- |style="text-align:left;"|{{mono|~/.zshenv}} | | | | | |yes |- |style="text-align:left;"|{{mono|~/.zprofile}} | | | | | |login |- |style="text-align:left;"|{{mono|~/.zshrc}} | | | | | |int. |- |style="text-align:left;"|{{mono|~/.zlogin}} | | | | | |login |- |style="text-align:left;"|{{mono|~/.zlogout}} | | | | | |login |} Explanation: * blank means a file is not read by a shell at all. * "yes" means a file is always read by a shell upon startup. * "login" means a file is read if the shell is a login shell. * "n/login" means a file is read if the shell is not a login shell. * "int." means a file is read if the shell is interactive. {{Clear}}{{Notelist}}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)