xref: /freebsd/share/man/man7/environ.7 (revision 05248206f720394d95c2a7475429311df670a2e9)
1.\" Copyright (c) 1983, 1990, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. Neither the name of the University nor the names of its contributors
13.\"    may be used to endorse or promote products derived from this software
14.\"    without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.\"	@(#)environ.7	8.3 (Berkeley) 4/19/94
29.\"
30.Dd August 5, 2020
31.Dt ENVIRON 7
32.Os
33.Sh NAME
34.Nm environ
35.Nd user environment
36.Sh SYNOPSIS
37.Ar extern char **environ ;
38.Sh DESCRIPTION
39An array of strings, called the
40.Ar environment
41is made available to each process by
42.Xr execve 2
43when a process begins.
44By convention these strings have the form
45.Va name Ns No = Ns Ar value ,
46and are referred to as
47.Dq environment variables .
48A process can query, update, and delete these strings using the
49.Xr getenv 3 ,
50.Xr setenv 3 ,
51and
52.Xr unsetenv 3
53functions, respectively.
54The shells also provide commands to manipulate the environment;
55they are described in the respective shell manual pages.
56.Pp
57What follows is a list of environment variables typically
58seen on a
59.Ux
60system.
61It includes only those variables that a user can expect to see during their
62day-to-day use of the system, and is far from complete.
63Environment variables specific to a particular program or library function
64are documented in the
65.Sx ENVIRONMENT
66section of the appropriate manual page.
67.Sh ENVIRONMENT
68.Bl -tag -width LD_LIBRARY_PATH
69.It Ev BLOCKSIZE
70The size of the block units used by several disk-related commands,
71most notably
72.Xr df 1 ,
73.Xr du 1
74and
75.Xr ls 1 .
76.Ev BLOCKSIZE
77may be specified in units of a byte by specifying a number,
78in units of a kilobyte by specifying a number followed by
79.Ql K
80or
81.Ql k ,
82in units of a megabyte by specifying a number followed by
83.Ql M
84or
85.Ql m ,
86and in units of a gigabyte by specifying a number followed
87by
88.Ql G
89or
90.Ql g .
91Sizes less than 512 bytes or greater than a gigabyte are ignored.
92This variable is processed by the
93.Xr getbsize 3
94function.
95.It Ev COLUMNS
96The user's preferred width in column positions for the terminal.
97Utilities such as
98.Xr ls 1
99and
100.Xr who 1
101use this to format output into columns.
102If unset or empty, utilities will use an
103.Xr ioctl 2
104call to ask the terminal driver for the width.
105.It Ev EDITOR
106Default editor name.
107.It Ev EXINIT
108A startup list of commands read by
109.Xr ex 1
110and
111.Xr vi 1 .
112.It Ev HOME
113A user's login directory, set by
114.Xr login 1
115from the password file
116.Xr passwd 5 .
117.It Ev LANG
118This variable configures all programs which use
119.Xr setlocale 3
120to use the specified locale unless the
121.Ev LC_*
122variables are set.
123.It Ev LC_ALL
124Overrides the values of
125.Ev LC_COLLATE ,
126.Ev LC_CTYPE ,
127.Ev LC_MESSAGES ,
128.Ev LC_MONETARY ,
129.Ev LC_NUMERIC ,
130.Ev LC_TIME
131and
132.Ev LANG .
133.It Ev LC_COLLATE
134Locale to be used for ordering of strings.
135.It Ev LC_CTYPE
136Locale to be used for character classification
137(letter, space, digit, etc.) and for interpreting byte sequences as
138multibyte characters.
139.It Ev LC_MESSAGES
140Locale to be used for diagnostic messages.
141.It Ev LC_MONETARY
142Locale to be used for interpreting monetary input
143and formatting output.
144.It Ev LC_NUMERIC
145Locale to be used for interpreting numeric input and
146formatting output.
147.It Ev LC_TIME
148Locale to be used for interpreting dates input and
149for formatting output.
150.It Ev MAIL
151The location of the user's
152mailbox instead of the default in /var/mail,
153used by
154.Xr mail 1 ,
155.Xr sh 1 ,
156and many other mail clients.
157.It Ev MANPATH
158The sequence of directories, separated by colons, searched by
159.Xr man 1
160when looking for manual pages.
161.It Ev NLSPATH
162List of directories to be searched for the message catalog referred to by
163.Ev LC_MESSAGES .
164See
165.Xr catopen 3 .
166.It Ev PAGER
167Default paginator program.
168The program specified by this variable is used by
169.Xr mail 1 ,
170.Xr man 1 ,
171.Xr ftp 1 ,
172etc, to display information which is longer than the current display.
173.It Ev PATH
174The sequence of directories, separated by colons, searched by
175.Xr csh 1 ,
176.Xr sh 1 ,
177.Xr system 3 ,
178.Xr execvp 3 ,
179etc, when looking for an executable file.
180.Ev PATH
181is set to ``/usr/bin:/bin'' initially by
182.Xr login 1 .
183.It Ev POSIXLY_CORRECT
184When set to any value, this environment variable modifies the behaviour
185of certain commands to (mostly) execute in a strictly POSIX-compliant manner.
186.It Ev PRINTER
187The name of the default printer to be used by
188.Xr lpr 1 ,
189.Xr lpq 1 ,
190and
191.Xr lprm 1 .
192.It Ev PWD
193The current directory pathname.
194.It Ev SHELL
195The full pathname of the user's login shell.
196.It Ev TERM
197The kind of terminal for which output is to be prepared.
198This information is used by commands, such as
199.Xr nroff 1 Pq Pa ports/textproc/groff
200or
201.Xr plot 1
202which may exploit special terminal capabilities.
203See
204.Pa /usr/share/misc/termcap
205.Pq Xr termcap 5
206for a list of terminal types.
207.It Ev TERMCAP
208The string describing the terminal in
209.Ev TERM ,
210or, if
211it begins with a '/', the name of the termcap file.
212See
213.Ev TERMPATH
214below, and
215.Xr termcap 5 .
216.It Ev TERMPATH
217A sequence of pathnames of termcap files, separated by colons or spaces,
218which are searched for terminal descriptions in the order listed.
219Having
220no
221.Ev TERMPATH
222is equivalent to a
223.Ev TERMPATH
224of
225.Pa $HOME/.termcap:/etc/termcap .
226.Ev TERMPATH
227is ignored if
228.Ev TERMCAP
229contains a full pathname.
230.It Ev TMPDIR
231The directory in which to store temporary files.
232Most applications use either
233.Pa /tmp
234or
235.Pa /var/tmp .
236Setting this variable will make them use another directory.
237.It Ev TZ
238The timezone to use when displaying dates.
239The normal format is a pathname relative to
240.Pa /usr/share/zoneinfo .
241For example, the command
242.Pp
243.Dl env TZ=America/Los_Angeles date
244.Pp
245displays the current time in California.
246See
247.Xr tzset 3
248for more information.
249.It Ev USER
250The login name of the user.
251It is recommended that portable applications use
252.Ev LOGNAME
253instead.
254.El
255.Pp
256Further names may be placed in the environment by the
257.Ic export
258command and
259.Ar name=value
260arguments in
261.Xr sh 1 ,
262or by the
263.Ic setenv
264command if you use
265.Xr csh 1 .
266It is unwise to change certain
267.Xr sh 1
268variables that are frequently exported by
269.Pa .profile
270files, such as
271.Ev MAIL ,
272.Ev PS1 ,
273.Ev PS2 ,
274and
275.Ev IFS ,
276unless you know what you are doing.
277.Pp
278The current environment variables can be printed with
279.Xr env 1 ,
280.Xr set 1
281or
282.Xr printenv 1
283in
284.Xr sh 1
285and
286.Xr env 1 ,
287.Xr printenv 1
288or the
289.Cm printenv
290built-in command in
291.Xr csh 1 .
292.Sh SEE ALSO
293.Xr cd 1 ,
294.Xr csh 1 ,
295.Xr env 1 ,
296.Xr ex 1 ,
297.Xr login 1 ,
298.Xr printenv 1 ,
299.Xr sh 1 ,
300.Xr execve 2 ,
301.Xr execle 3 ,
302.Xr getbsize 3 ,
303.Xr getenv 3 ,
304.Xr setenv 3 ,
305.Xr setlocale 3 ,
306.Xr system 3 ,
307.Xr termcap 3 ,
308.Xr termcap 5
309.Sh HISTORY
310The
311.Nm
312manual page appeared in
313.At v7 .
314