1ENVIRON(7) Linux Programmer's Manual ENVIRON(7)
2
3
4
6 environ - user environment
7
9 extern char **environ;
10
12 The variable environ points to an array of pointers to strings called
13 the "environment". The last pointer in this array has the value NULL.
14 (This variable must be declared in the user program, but is declared in
15 the header file <unistd.h> if the _GNU_SOURCE feature test macro is
16 defined.) This array of strings is made available to the process by
17 the exec(3) call that started the process. When a child process is
18 created via fork(2), it inherits a copy of its parent's environment.
19
20 By convention the strings in environ have the form "name=value". Com‐
21 mon examples are:
22
23 USER The name of the logged-in user (used by some BSD-derived pro‐
24 grams).
25
26 LOGNAME
27 The name of the logged-in user (used by some System-V derived
28 programs).
29
30 HOME A user's login directory, set by login(1) from the password file
31 passwd(5).
32
33 LANG The name of a locale to use for locale categories when not over‐
34 ridden by LC_ALL or more specific environment variables such as
35 LC_COLLATE, LC_CTYPE, LC_MESSAGES, LC_MONETARY, LC_NUMERIC, and
36 LC_TIME (see locale(7) for further details of the LC_* environ‐
37 ment variables).
38
39 PATH The sequence of directory prefixes that sh(1) and many other
40 programs apply in searching for a file known by an incomplete
41 pathname. The prefixes are separated by ':'. (Similarly one
42 has CDPATH used by some shells to find the target of a change
43 directory command, MANPATH used by man(1) to find manual pages,
44 and so on)
45
46 PWD The current working directory. Set by some shells.
47
48 SHELL The pathname of the user's login shell.
49
50 TERM The terminal type for which output is to be prepared.
51
52 PAGER The user's preferred utility to display text files.
53
54 EDITOR/VISUAL
55 The user's preferred utility to edit text files.
56
57 Names may be placed in the shell's environment by the export command in
58 sh(1), or by the setenv command if you use csh(1).
59
60 The initial environment of the shell is populated in various ways, such
61 as definitions from /etc/environment that are processed by pam_env(8)
62 for all users at login time (on systems that employ pam(8)). In addi‐
63 tion, various shell initialization scripts, such as the system-wide
64 /etc/profile script and per-user