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