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