.\" Copyright (c) 1993 Michael Haardt (u31b3hs@pool.informatik.rwth-aachen.de), .\" Fri Apr 2 11:32:09 MET DST 1993 .\" and Andries Brouwer (aeb@cwi.nl), Fri Feb 14 21:47:50 1997. .\" .\" This is free documentation; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License as .\" published by the Free Software Foundation; either version 2 of .\" the License, or (at your option) any later version. .\" .\" The GNU General Public License's references to "object code" .\" and "executables" are to be interpreted as the output of any .\" document formatting or typesetting system, including .\" intermediate and printed output. .\" .\" This manual is distributed in the hope that it will be useful, .\" but WITHOUT ANY WARRANTY; without even the implied warranty of .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the .\" GNU General Public License for more details. .\" .\" You should have received a copy of the GNU General Public .\" License along with this manual; if not, write to the Free .\" Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, .\" USA. .\" .\" Modified Sun Jul 25 10:45:30 1993 by Rik Faith (faith@cs.unc.edu) .\" Modified Sun Jul 21 21:25:26 1996 by Andries Brouwer (aeb@cwi.nl) .\" Modified Mon Oct 21 17:47:19 1996 by Eric S. Raymond (esr@thyrsus.com) .\" .TH ENVIRON 5 "October 21, 1996" "Linux" "Linux Programmer's Manual" .SH NAME environ \- user environment .SH SYNOPSIS .ad l .nf .B #include .sp .B extern char **environ; .fi .ad b .SH DESCRIPTION An array of strings called the `environment' is made available by \fBexec\fP(2) when a process begins. By convention these strings have the form `\fIname\fP\fB=\fP\fIvalue\fP'. Common examples are: .TP .B USER The name of the logged-in user (used by some BSD-derived programs). .TP .B LOGNAME The name of the logged-in user (used by some System-V derived programs). .TP .B HOME A user's login directory, set by \fBlogin\fP(1) from the password file \fBpasswd\fP(5). .TP .B LANG The name of a locale to use for locale categories when not overridden by \fBLC_ALL\fP or more specific environment variables. .TP .B PATH The sequence of directory prefixes that \fBsh\fP(1) and many other programs apply in searching for a file known by an incomplete path name. The prefixes are separated by `\fB:\fP'. (Similarly one has \fBCDPATH\fP used by some shells to find the target of a change directory command, \fBMANPATH\fP used by \fBman\fP(1) to find manual pages, etc.) .TP .B PWD The current working directory. Set by some shells. .TP .B SHELL The file name of the user's login shell. .TP .B TERM The terminal type for which output is to be prepared. .PP Further names may be placed in the environment by the \fBexport\fP command and `name=value' in \fBsh\fP(1), or by the \fBsetenv\fP command if you use \fBcsh\fP(1). Arguments may also be placed in the environment at the point of an \fBexec\fP(2). A C program can manipulate its environment using the functions \fBgetenv\fP(), \fBputenv\fP(), \fBsetenv\fP() and \fBunsetenv\fP(). Note that the behaviour of many programs and library routines is influenced by the presence or value of certain environment variables. A random collection: .LP The variables LANG, LANGUAGE, NLSPATH, LOCPATH, LC_ALL, LC_MESSAGES etc. influence locale handling. .LP TMPDIR influences the path prefix of names created by \fBtmpnam()\fP and other routines, the temporary directory used by \fBsort\fP(1) and other programs, etc. .LP LD_LIBRARY_PATH, LD_PRELOAD and other LD_* variables influence the behaviour of the dynamic loader/linker. .LP POSIXLY_CORRECT makes certain programs and library routines follow the prescriptions of POSIX. .LP The behaviour of \fBmalloc\fP() is influenced by MALLOC_* variables. .LP The variable HOSTALIASES gives the name of a file containing aliases to be used with \fBgethostbyname\fP(). .LP TZ and TZDIR give time zone information. .LP TERMCAP gives information on how to address a given terminal (or gives the name of a file containing such information). .LP Etc. etc. Clearly there is a security risk here. Many a system command has been tricked into mischief by a user who specified unusual values for IFS or LD_LIBRARY_PATH. .SH "SEE ALSO" .BR login (1), .BR sh (1), .BR bash (1), .BR csh (1), .BR tcsh (1), .BR exec (2), .BR getenv (3), .BR putenv (3), .BR setenv (3), .BR unsetenv (3).