{"id":4077,"date":"2022-12-20T17:39:20","date_gmt":"2022-12-20T20:39:20","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/environ-man7\/"},"modified":"2022-12-20T17:39:20","modified_gmt":"2022-12-20T20:39:20","slug":"environ-man7","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/environ-man7\/","title":{"rendered":"ENVIRON (man7)"},"content":{"rendered":"<h1 align=\"center\">ENVIRON<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#NOTES\">NOTES<\/a><br \/> <a href=\"#BUGS\">BUGS<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#COLOPHON\">COLOPHON<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">environ \u2212 user environment<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>extern char **<\/b><i>environ<\/i><b>;<\/b><\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The variable <i>environ<\/i> points to an array of pointers to strings called the &#8220;environment&#8221;. The last pointer in this array has the value NULL. (This variable must be declared in the user program, but is declared in the header file <i><unistd.h><\/i> if the <b>_GNU_SOURCE<\/b> feature test macro is defined.) This array of strings is made available to the process by the <b>exec<\/b>(3) call that started the process. When a child process is created via <b>fork<\/b>(2), it inherits a <i>copy<\/i> of its parent\u2019s environment.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">By convention the strings in <i>environ<\/i> have the form &#8220;<i>name<\/i><b>=<\/b><i>value<\/i>&#8220;. Common examples are:<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"6%\">\n<p><b>USER<\/b><\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"78%\">\n<p>The name of the logged-in user (used by some BSD-derived programs).<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%;\"><b>LOGNAME<\/b><\/p>\n<p style=\"margin-left:22%;\">The name of the logged-in user (used by some System-V derived programs).<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"7%\">\n<p><b>HOME<\/b><\/p>\n<\/td>\n<td width=\"4%\"><\/td>\n<td width=\"78%\">\n<p>A user\u2019s login directory, set by <b>login<\/b>(1) from the password file <b>passwd<\/b>(5).<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"7%\">\n<p><b>LANG<\/b><\/p>\n<\/td>\n<td width=\"4%\"><\/td>\n<td width=\"78%\">\n<p>The name of a locale to use for locale categories when not overridden by <b>LC_ALL<\/b> or more specific environment variables such as <b>LC_COLLATE<\/b>, <b>LC_CTYPE<\/b>, <b>LC_MESSAGES<\/b>, <b>LC_MONETARY<\/b>, <b>LC_NUMERIC<\/b>, and <b>LC_TIME<\/b> (see <b>locale<\/b>(7) for further details of the <b>LC_*<\/b> environment variables).<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"7%\">\n<p><b>PATH<\/b><\/p>\n<\/td>\n<td width=\"4%\"><\/td>\n<td width=\"78%\">\n<p>The sequence of directory prefixes that <b>sh<\/b>(1) and many other programs apply in searching for a file known by an incomplete pathname. The prefixes are separated by &#8216;<b>:<\/b>&#8216;. (Similarly one has <b>CDPATH<\/b> used by some shells to find the target of a change directory command, <b>MANPATH<\/b> used by <b>man<\/b>(1) to find manual pages, and so on)<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"7%\">\n<p><b>PWD<\/b><\/p>\n<\/td>\n<td width=\"4%\"><\/td>\n<td width=\"78%\">\n<p>The current working directory. Set by some shells.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"7%\">\n<p><b>SHELL<\/b><\/p>\n<\/td>\n<td width=\"4%\"><\/td>\n<td width=\"78%\">\n<p>The pathname of the user\u2019s login shell.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"7%\">\n<p><b>TERM<\/b><\/p>\n<\/td>\n<td width=\"4%\"><\/td>\n<td width=\"78%\">\n<p>The terminal type for which output is to be prepared.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"7%\">\n<p><b>PAGER<\/b><\/p>\n<\/td>\n<td width=\"4%\"><\/td>\n<td width=\"78%\">\n<p>The user\u2019s preferred utility to display text files.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%;\"><b>EDITOR<\/b>\/<b>VISUAL<\/b><\/p>\n<p style=\"margin-left:22%;\">The user\u2019s preferred utility to edit text files.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Names may be placed in the shell\u2019s environment by the <i>export<\/i> command in <b>sh<\/b>(1), or by the <i>setenv<\/i> command if you use <b>csh<\/b>(1).<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The initial environment of the shell is populated in various ways, such as definitions from <i>\/etc\/environment<\/i> that are processed by <b>pam_env<\/b>(8) for all users at login time (on systems that employ <b>pam<\/b>(8)). In addition, various shell initialization scripts, such as the system-wide <i>\/etc\/profile<\/i> script and per-user initializations script may include commands that add variables to the shell\u2019s environment; see the manual page of your preferred shell for details.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Bourne-style shells support the syntax<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">NAME=value command<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">to create an environment variable definition only in the scope of the process that executes <i>command<\/i>. Multiple variable definitions, separated by white space, may precede <i>command<\/i>.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Arguments may also be placed in the environment at the point of an <b>exec<\/b>(3). A C program can manipulate its environment using the functions <b>getenv<\/b>(3), <b>putenv<\/b>(3), <b>setenv<\/b>(3), and <b>unsetenv<\/b>(3).<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Note that the behavior of many programs and library routines is influenced by the presence or value of certain environment variables. Examples include the following:<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>*<\/p>\n<\/td>\n<td width=\"3%\"><\/td>\n<td width=\"85%\">\n<p>The variables <b>LANG<\/b>, <b>LANGUAGE<\/b>, <b>NLSPATH<\/b>, <b>LOCPATH<\/b>, <b>LC_ALL<\/b>, <b>LC_MESSAGES<\/b>, and so on influence locale handling; see <b>catopen<\/b>(3), <b>gettext<\/b>(3), and <b>locale<\/b>(7).<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>*<\/p>\n<\/td>\n<td width=\"3%\"><\/td>\n<td width=\"85%\">\n<p><b>TMPDIR<\/b> influences the path prefix of names created by <b>tempnam<\/b>(3) and other routines, and the temporary directory used by <b>sort<\/b>(1) and other programs.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>*<\/p>\n<\/td>\n<td width=\"3%\"><\/td>\n<td width=\"85%\">\n<p><b>LD_LIBRARY_PATH<\/b>, <b>LD_PRELOAD<\/b>, and other <b>LD_*<\/b> variables influence the behavior of the dynamic loader\/linker.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>*<\/p>\n<\/td>\n<td width=\"3%\"><\/td>\n<td width=\"85%\">\n<p><b>POSIXLY_CORRECT<\/b> makes certain programs and library routines follow the prescriptions of POSIX.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>*<\/p>\n<\/td>\n<td width=\"3%\"><\/td>\n<td width=\"85%\">\n<p>The behavior of <b>malloc<\/b>(3) is influenced by <b>MALLOC_*<\/b> variables.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>*<\/p>\n<\/td>\n<td width=\"3%\"><\/td>\n<td width=\"85%\">\n<p>The variable <b>HOSTALIASES<\/b> gives the name of a file containing aliases to be used with <b>gethostbyname<\/b>(3).<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>*<\/p>\n<\/td>\n<td width=\"3%\"><\/td>\n<td width=\"85%\">\n<p><b>TZ<\/b> and <b>TZDIR<\/b> give timezone information used by <b>tzset<\/b>(3) and through that by functions like <b>ctime<\/b>(3), <b>localtime<\/b>(3), <b>mktime<\/b>(3), <b>strftime<\/b>(3). See also <b>tzselect<\/b>(8).<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>*<\/p>\n<\/td>\n<td width=\"3%\"><\/td>\n<td width=\"85%\">\n<p><b>TERMCAP<\/b> gives information on how to address a given terminal (or gives the name of a file containing such information).<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>*<\/p>\n<\/td>\n<td width=\"3%\"><\/td>\n<td width=\"85%\">\n<p><b>COLUMNS<\/b> and <b>LINES<\/b> tell applications about the window size, possibly overriding the actual size.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>*<\/p>\n<\/td>\n<td width=\"3%\"><\/td>\n<td width=\"85%\">\n<p><b>PRINTER<\/b> or <b>LPDEST<\/b> may specify the desired printer to use. See <b>lpr<\/b>(1).<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<h2>NOTES <a name=\"NOTES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>prctl<\/b>(2) <b>PR_SET_MM_ENV_START<\/b> and <b>PR_SET_MM_ENV_END<\/b> operations can be used to control the location of the process\u2019s environment.<\/p>\n<h2>BUGS <a name=\"BUGS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Clearly there is a security risk here. Many a system command has been tricked into mischief by a user who specified unusual values for <b>IFS<\/b> or <b>LD_LIBRARY_PATH<\/b>.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">There is also the risk of name space pollution. Programs like <i>make<\/i> and <i>autoconf<\/i> allow overriding of default utility names from the environment with similarly named variables in all caps. Thus one uses <b>CC<\/b> to select the desired C compiler (and similarly <b>MAKE<\/b>, <b>AR<\/b>, <b>AS<\/b>, <b>FC<\/b>, <b>LD<\/b>, <b>LEX<\/b>, <b>RM<\/b>, <b>YACC<\/b>, etc.). However, in some traditional uses such an environment variable gives options for the program instead of a pathname. Thus, one has <b>MORE<\/b>, <b>LESS<\/b>, and <b>GZIP<\/b>. Such usage is considered mistaken, and to be avoided in new programs. The authors of <i>gzip<\/i> should consider renaming their option to <b>GZIP_OPT<\/b>.<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>bash<\/b>(1), <b>csh<\/b>(1), <b>env<\/b>(1), <b>login<\/b>(1), <b>printenv<\/b>(1), <b>sh<\/b>(1), <b>tcsh<\/b>(1), <b>execve<\/b>(2), <b>clearenv<\/b>(3), <b>exec<\/b>(3), <b>getenv<\/b>(3), <b>putenv<\/b>(3), <b>setenv<\/b>(3), <b>unsetenv<\/b>(3), <b>locale<\/b>(7), <b>ld.so<\/b>(8), <b>pam_env<\/b>(8)<\/p>\n<h2>COLOPHON <a name=\"COLOPHON\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This page is part of release 5.10 of the Linux <i>man-pages<\/i> project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https:\/\/www.kernel.org\/doc\/man\u2212pages\/.<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  environ \u2212 user environment <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[971],"tags":[973,1157,972],"class_list":["post-4077","post","type-post","status-publish","format-standard","hentry","category-7-miscelanea","tag-973","tag-environ","tag-man7"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/4077","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=4077"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/4077\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=4077"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=4077"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=4077"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}