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