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