1 .\" Copyright (c) 1993 Michael Haardt (michael@moria.de),
2 .\" Fri Apr 2 11:32:09 MET DST 1993
3 .\" and Andries Brouwer (aeb@cwi.nl), Fri Feb 14 21:47:50 1997.
5 .\" %%%LICENSE_START(GPLv2+_DOC_FULL)
6 .\" This is free documentation; you can redistribute it and/or
7 .\" modify it under the terms of the GNU General Public License as
8 .\" published by the Free Software Foundation; either version 2 of
9 .\" the License, or (at your option) any later version.
11 .\" The GNU General Public License's references to "object code"
12 .\" and "executables" are to be interpreted as the output of any
13 .\" document formatting or typesetting system, including
14 .\" intermediate and printed output.
16 .\" This manual is distributed in the hope that it will be useful,
17 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
18 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 .\" GNU General Public License for more details.
21 .\" You should have received a copy of the GNU General Public
22 .\" License along with this manual; if not, see
23 .\" <http://www.gnu.org/licenses/>.
26 .\" Modified Sun Jul 25 10:45:30 1993 by Rik Faith (faith@cs.unc.edu)
27 .\" Modified Sun Jul 21 21:25:26 1996 by Andries Brouwer (aeb@cwi.nl)
28 .\" Modified Mon Oct 21 17:47:19 1996 by Eric S. Raymond (esr@thyrsus.com)
29 .\" Modified Wed Aug 27 20:28:58 1997 by Nicolás Lichtmaier (nick@debian.org)
30 .\" Modified Mon Sep 21 00:00:26 1998 by Andries Brouwer (aeb@cwi.nl)
31 .\" Modified Wed Jan 24 06:37:24 2001 by Eric S. Raymond (esr@thyrsus.com)
32 .\" Modified Thu Dec 13 23:53:27 2001 by Martin Schulze <joey@infodrom.org>
34 .TH ENVIRON 7 2016-10-08 "Linux" "Linux Programmer's Manual"
36 environ \- user environment
39 .BI "extern char **" environ ;
45 points to an array of pointers to strings called the "environment".
46 The last pointer in this array has the value NULL.
47 (This variable must be declared in the user program,
48 but is declared in the header file
52 feature test macro is defined.)
53 This array of strings is made available to the process by the
55 call that started the process.
56 When a child process is created via
60 of its parent's environment.
62 By convention the strings in
64 have the form "\fIname\fP\fB=\fP\fIvalue\fP".
68 The name of the logged-in user (used by some BSD-derived programs).
71 The name of the logged-in user (used by some System-V derived programs).
74 A user's login directory, set by
76 from the password file
80 The name of a locale to use for locale categories when not overridden
83 or more specific environment variables such as
93 for further details of the
95 environment variables).
98 The sequence of directory prefixes that
101 programs apply in searching for a file known by an incomplete pathname.
102 The prefixes are separated by \(aq\fB:\fP\(aq.
105 used by some shells to find the target
106 of a change directory command,
110 to find manual pages, and so on)
113 The current working directory.
117 The pathname of the user's login shell.
120 The terminal type for which output is to be prepared.
123 The user's preferred utility to display text files.
126 The user's preferred utility to edit text files.
129 .\" The user's preferred utility to browse URLs. Sequence of colon-separated
130 .\" browser commands. See http://www.catb.org/~esr/BROWSER/ .
132 Names may be placed in the shell's environment by the
141 The initial environment of the shell is populated in various ways,
142 such as definitions from
144 that are processed by
146 for all users at login time (on systems that employ
148 In addition, various shell initialization scripts, such as the system-wide
150 script and per-user initializations script may include commands
151 that add variables to the shell's environment;
152 see the manual page of your preferred shell for details.
154 Bourne-style shells support the syntax
158 to create an environment variable definition only in the scope
159 of the process that executes
161 Multiple variable definitions, separated by white space, may precede
164 Arguments may also be placed in the
165 environment at the point of an
167 A C program can manipulate its environment using the functions
174 Note that the behavior of many programs and library routines is
175 influenced by the presence or value of certain environment variables.
179 .BR LANG ", " LANGUAGE ", " NLSPATH ", " LOCPATH ", "
180 .BR LC_ALL ", " LC_MESSAGES ", "
181 and so on influence locale handling; see
188 influences the path prefix of names created by
190 and other routines, and the temporary directory used by
194 .BR LD_LIBRARY_PATH ", " LD_PRELOAD
195 and other LD_* variables influence
196 the behavior of the dynamic loader/linker.
199 makes certain programs and library routines follow
200 the prescriptions of POSIX.
210 gives the name of a file containing aliases
212 .BR gethostbyname (3).
215 give timezone information used by
217 and through that by functions like
226 gives information on how to address a given terminal
227 (or gives the name of a file containing such information).
229 .BR COLUMNS " and " LINES
230 tell applications about the window size, possibly overriding the actual size.
232 .BR PRINTER " or " LPDEST
233 may specify the desired printer to use.
237 Clearly there is a security risk here.
238 Many a system command has been
239 tricked into mischief by a user who specified unusual values for
240 .BR IFS " or " LD_LIBRARY_PATH .
242 There is also the risk of name space pollution.
247 allow overriding of default utility names from the
248 environment with similarly named variables in all caps.
251 to select the desired C compiler (and similarly
261 However, in some traditional uses such an environment variable
262 gives options for the program instead of a pathname.
268 Such usage is considered mistaken, and to be avoided in new
272 should consider renaming their option to