xref: /freebsd/share/man/man7/environ.7 (revision 97759ccc715c4b365432c16d763c50eecfcb1100)
1afe61c15SRodney W. Grimes.\" Copyright (c) 1983, 1990, 1993
2afe61c15SRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
3afe61c15SRodney W. Grimes.\"
4afe61c15SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
5afe61c15SRodney W. Grimes.\" modification, are permitted provided that the following conditions
6afe61c15SRodney W. Grimes.\" are met:
7afe61c15SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
8afe61c15SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
9afe61c15SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
10afe61c15SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
11afe61c15SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
12dda5b397SEitan Adler.\" 3. Neither the name of the University nor the names of its contributors
13afe61c15SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
14afe61c15SRodney W. Grimes.\"    without specific prior written permission.
15afe61c15SRodney W. Grimes.\"
16afe61c15SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17afe61c15SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18afe61c15SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19afe61c15SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20afe61c15SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21afe61c15SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22afe61c15SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23afe61c15SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24afe61c15SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25afe61c15SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26afe61c15SRodney W. Grimes.\" SUCH DAMAGE.
27afe61c15SRodney W. Grimes.\"
28*d41afb81SRobert Clausecker.Dd September 3, 2023
29afe61c15SRodney W. Grimes.Dt ENVIRON 7
303d45e180SRuslan Ermilov.Os
31afe61c15SRodney W. Grimes.Sh NAME
32afe61c15SRodney W. Grimes.Nm environ
33afe61c15SRodney W. Grimes.Nd user environment
34afe61c15SRodney W. Grimes.Sh SYNOPSIS
35afe61c15SRodney W. Grimes.Ar extern char **environ ;
36afe61c15SRodney W. Grimes.Sh DESCRIPTION
376d34415fSGordon BerglingAn array of strings, called the
38afe61c15SRodney W. Grimes.Ar environment
396d34415fSGordon Berglingis made available to each process by
40afe61c15SRodney W. Grimes.Xr execve 2
415203edcdSRuslan Ermilovwhen a process begins.
425203edcdSRuslan ErmilovBy convention these strings have the form
436d34415fSGordon Bergling.Va name Ns No = Ns Ar value ,
446d34415fSGordon Berglingand are referred to as
456d34415fSGordon Bergling.Dq environment variables .
466d34415fSGordon BerglingA process can query, update, and delete these strings using the
476d34415fSGordon Bergling.Xr getenv 3 ,
486d34415fSGordon Bergling.Xr setenv 3 ,
496d34415fSGordon Berglingand
506d34415fSGordon Bergling.Xr unsetenv 3
516d34415fSGordon Berglingfunctions, respectively.
526d34415fSGordon BerglingThe shells also provide commands to manipulate the environment;
536d34415fSGordon Berglingthey are described in the respective shell manual pages.
546d34415fSGordon Bergling.Pp
556d34415fSGordon BerglingWhat follows is a list of environment variables typically
566d34415fSGordon Berglingseen on a
576d34415fSGordon Bergling.Ux
586d34415fSGordon Berglingsystem.
596d34415fSGordon BerglingIt includes only those variables that a user can expect to see during their
606d34415fSGordon Berglingday-to-day use of the system, and is far from complete.
616d34415fSGordon BerglingEnvironment variables specific to a particular program or library function
626d34415fSGordon Berglingare documented in the
636d34415fSGordon Bergling.Sx ENVIRONMENT
646d34415fSGordon Berglingsection of the appropriate manual page.
656d34415fSGordon Bergling.Sh ENVIRONMENT
666d34415fSGordon Bergling.Bl -tag -width LD_LIBRARY_PATH
67*d41afb81SRobert Clausecker.It Ev ARCHLEVEL
68*d41afb81SRobert ClauseckerOn
69*d41afb81SRobert Clausecker.Em amd64 ,
70*d41afb81SRobert Clauseckercontrols the level of SIMD enhancements used.
71*d41afb81SRobert ClauseckerSee
72*d41afb81SRobert Clausecker.Xr simd 7
73*d41afb81SRobert Clauseckerfor details.
74afe61c15SRodney W. Grimes.It Ev BLOCKSIZE
756d34415fSGordon BerglingThe size of the block units used by several disk-related commands,
766d34415fSGordon Berglingmost notably
77afe61c15SRodney W. Grimes.Xr df 1 ,
78afe61c15SRodney W. Grimes.Xr du 1
79afe61c15SRodney W. Grimesand
80afe61c15SRodney W. Grimes.Xr ls 1 .
816d34415fSGordon Bergling.Ev BLOCKSIZE
826d34415fSGordon Berglingmay be specified in units of a byte by specifying a number,
836d34415fSGordon Berglingin units of a kilobyte by specifying a number followed by
846d34415fSGordon Bergling.Ql K
856d34415fSGordon Berglingor
866d34415fSGordon Bergling.Ql k ,
876d34415fSGordon Berglingin units of a megabyte by specifying a number followed by
886d34415fSGordon Bergling.Ql M
896d34415fSGordon Berglingor
906d34415fSGordon Bergling.Ql m ,
916d34415fSGordon Berglingand in units of a gigabyte by specifying a number followed
926d34415fSGordon Berglingby
936d34415fSGordon Bergling.Ql G
946d34415fSGordon Berglingor
956d34415fSGordon Bergling.Ql g .
966d34415fSGordon BerglingSizes less than 512 bytes or greater than a gigabyte are ignored.
97370cbbf2SGreg LeheyThis variable is processed by the
98370cbbf2SGreg Lehey.Xr getbsize 3
99370cbbf2SGreg Leheyfunction.
100c309b053STim J. Robbins.It Ev COLUMNS
101c309b053STim J. RobbinsThe user's preferred width in column positions for the terminal.
102c309b053STim J. RobbinsUtilities such as
103c309b053STim J. Robbins.Xr ls 1
104c309b053STim J. Robbinsand
105c309b053STim J. Robbins.Xr who 1
106c309b053STim J. Robbinsuse this to format output into columns.
107c309b053STim J. RobbinsIf unset or empty, utilities will use an
108c309b053STim J. Robbins.Xr ioctl 2
109c309b053STim J. Robbinscall to ask the terminal driver for the width.
11006651299SMike Pritchard.It Ev EDITOR
11106651299SMike PritchardDefault editor name.
112afe61c15SRodney W. Grimes.It Ev EXINIT
113afe61c15SRodney W. GrimesA startup list of commands read by
1144571317aSJoseph Koshy.Xr ex 1
115afe61c15SRodney W. Grimesand
116afe61c15SRodney W. Grimes.Xr vi 1 .
117afe61c15SRodney W. Grimes.It Ev HOME
118afe61c15SRodney W. GrimesA user's login directory, set by
119afe61c15SRodney W. Grimes.Xr login 1
120afe61c15SRodney W. Grimesfrom the password file
121afe61c15SRodney W. Grimes.Xr passwd 5 .
12201eddd58SAndrey A. Chernov.It Ev LANG
123edf0e5b3SMike PritchardThis variable configures all programs which use
124906c1e27SMike Pritchard.Xr setlocale 3
125a5c2a55dSAndrey A. Chernovto use the specified locale unless the
126a5c2a55dSAndrey A. Chernov.Ev LC_*
127a5c2a55dSAndrey A. Chernovvariables are set.
12866d62591STim J. Robbins.It Ev LC_ALL
12966d62591STim J. RobbinsOverrides the values of
13066d62591STim J. Robbins.Ev LC_COLLATE ,
13166d62591STim J. Robbins.Ev LC_CTYPE ,
13266d62591STim J. Robbins.Ev LC_MESSAGES ,
13366d62591STim J. Robbins.Ev LC_MONETARY ,
134a5c2a55dSAndrey A. Chernov.Ev LC_NUMERIC ,
135a5c2a55dSAndrey A. Chernov.Ev LC_TIME
13666d62591STim J. Robbinsand
137a5c2a55dSAndrey A. Chernov.Ev LANG .
13866d62591STim J. Robbins.It Ev LC_COLLATE
13966d62591STim J. RobbinsLocale to be used for ordering of strings.
14066d62591STim J. Robbins.It Ev LC_CTYPE
14166d62591STim J. RobbinsLocale to be used for character classification
14266d62591STim J. Robbins(letter, space, digit, etc.) and for interpreting byte sequences as
14366d62591STim J. Robbinsmultibyte characters.
14466d62591STim J. Robbins.It Ev LC_MESSAGES
14566d62591STim J. RobbinsLocale to be used for diagnostic messages.
14666d62591STim J. Robbins.It Ev LC_MONETARY
14766d62591STim J. RobbinsLocale to be used for interpreting monetary input
14866d62591STim J. Robbinsand formatting output.
14966d62591STim J. Robbins.It Ev LC_NUMERIC
15066d62591STim J. RobbinsLocale to be used for interpreting numeric input and
15166d62591STim J. Robbinsformatting output.
15266d62591STim J. Robbins.It Ev LC_TIME
15366d62591STim J. RobbinsLocale to be used for interpreting dates input and
15466d62591STim J. Robbinsfor formatting output.
155c7fa2a65SWolfram Schneider.It Ev MAIL
156c7fa2a65SWolfram SchneiderThe location of the user's
157c7fa2a65SWolfram Schneidermailbox instead of the default in /var/mail,
158c7fa2a65SWolfram Schneiderused by
159c7fa2a65SWolfram Schneider.Xr mail 1 ,
160c7fa2a65SWolfram Schneider.Xr sh 1 ,
161c7fa2a65SWolfram Schneiderand many other mail clients.
1626d34415fSGordon Bergling.It Ev MANPATH
1636d34415fSGordon BerglingThe sequence of directories, separated by colons, searched by
1646d34415fSGordon Bergling.Xr man 1
1656d34415fSGordon Berglingwhen looking for manual pages.
16666d62591STim J. Robbins.It Ev NLSPATH
16766d62591STim J. RobbinsList of directories to be searched for the message catalog referred to by
16866d62591STim J. Robbins.Ev LC_MESSAGES .
16966d62591STim J. RobbinsSee
17066d62591STim J. Robbins.Xr catopen 3 .
17106651299SMike Pritchard.It Ev PAGER
1725203edcdSRuslan ErmilovDefault paginator program.
1735203edcdSRuslan ErmilovThe program specified by this variable is used by
17406651299SMike Pritchard.Xr mail 1 ,
17506651299SMike Pritchard.Xr man 1 ,
17606651299SMike Pritchard.Xr ftp 1 ,
17706651299SMike Pritchardetc, to display information which is longer than the current display.
178afe61c15SRodney W. Grimes.It Ev PATH
179afe61c15SRodney W. GrimesThe sequence of directories, separated by colons, searched by
180afe61c15SRodney W. Grimes.Xr csh 1 ,
181afe61c15SRodney W. Grimes.Xr sh 1 ,
182afe61c15SRodney W. Grimes.Xr system 3 ,
183afe61c15SRodney W. Grimes.Xr execvp 3 ,
184afe61c15SRodney W. Grimesetc, when looking for an executable file.
185edf0e5b3SMike Pritchard.Ev PATH
186edf0e5b3SMike Pritchardis set to ``/usr/bin:/bin'' initially by
187afe61c15SRodney W. Grimes.Xr login 1 .
1886d34415fSGordon Bergling.It Ev POSIXLY_CORRECT
1896d34415fSGordon BerglingWhen set to any value, this environment variable modifies the behaviour
1906d34415fSGordon Berglingof certain commands to (mostly) execute in a strictly POSIX-compliant manner.
191afe61c15SRodney W. Grimes.It Ev PRINTER
192afe61c15SRodney W. GrimesThe name of the default printer to be used by
193afe61c15SRodney W. Grimes.Xr lpr 1 ,
194afe61c15SRodney W. Grimes.Xr lpq 1 ,
195afe61c15SRodney W. Grimesand
196afe61c15SRodney W. Grimes.Xr lprm 1 .
19706651299SMike Pritchard.It Ev PWD
19806651299SMike PritchardThe current directory pathname.
199afe61c15SRodney W. Grimes.It Ev SHELL
200afe61c15SRodney W. GrimesThe full pathname of the user's login shell.
201afe61c15SRodney W. Grimes.It Ev TERM
202afe61c15SRodney W. GrimesThe kind of terminal for which output is to be prepared.
203afe61c15SRodney W. GrimesThis information is used by commands, such as
20420f68c5fSJens Schweikhardt.Xr nroff 1 Pq Pa ports/textproc/groff
205afe61c15SRodney W. Grimesor
206afe61c15SRodney W. Grimes.Xr plot 1
2075203edcdSRuslan Ermilovwhich may exploit special terminal capabilities.
2085203edcdSRuslan ErmilovSee
209afe61c15SRodney W. Grimes.Pa /usr/share/misc/termcap
210afe61c15SRodney W. Grimes.Pq Xr termcap 5
211afe61c15SRodney W. Grimesfor a list of terminal types.
212afe61c15SRodney W. Grimes.It Ev TERMCAP
213edf0e5b3SMike PritchardThe string describing the terminal in
214edf0e5b3SMike Pritchard.Ev TERM ,
215edf0e5b3SMike Pritchardor, if
216afe61c15SRodney W. Grimesit begins with a '/', the name of the termcap file.
217afe61c15SRodney W. GrimesSee
218afe61c15SRodney W. Grimes.Ev TERMPATH
2194571317aSJoseph Koshybelow, and
2204571317aSJoseph Koshy.Xr termcap 5 .
221afe61c15SRodney W. Grimes.It Ev TERMPATH
222afe61c15SRodney W. GrimesA sequence of pathnames of termcap files, separated by colons or spaces,
2235203edcdSRuslan Ermilovwhich are searched for terminal descriptions in the order listed.
2245203edcdSRuslan ErmilovHaving
225afe61c15SRodney W. Grimesno
226afe61c15SRodney W. Grimes.Ev TERMPATH
227afe61c15SRodney W. Grimesis equivalent to a
228afe61c15SRodney W. Grimes.Ev TERMPATH
229afe61c15SRodney W. Grimesof
2306d34415fSGordon Bergling.Pa $HOME/.termcap:/etc/termcap .
231afe61c15SRodney W. Grimes.Ev TERMPATH
232afe61c15SRodney W. Grimesis ignored if
233afe61c15SRodney W. Grimes.Ev TERMCAP
234afe61c15SRodney W. Grimescontains a full pathname.
235afe61c15SRodney W. Grimes.It Ev TMPDIR
236afe61c15SRodney W. GrimesThe directory in which to store temporary files.
237afe61c15SRodney W. GrimesMost applications use either
2386d34415fSGordon Bergling.Pa /tmp
239afe61c15SRodney W. Grimesor
2406d34415fSGordon Bergling.Pa /var/tmp .
241afe61c15SRodney W. GrimesSetting this variable will make them use another directory.
242afe61c15SRodney W. Grimes.It Ev TZ
243afe61c15SRodney W. GrimesThe timezone to use when displaying dates.
244afe61c15SRodney W. GrimesThe normal format is a pathname relative to
2456d34415fSGordon Bergling.Pa /usr/share/zoneinfo .
246afe61c15SRodney W. GrimesFor example, the command
2476d34415fSGordon Bergling.Pp
2486d34415fSGordon Bergling.Dl env TZ=America/Los_Angeles date
2496d34415fSGordon Bergling.Pp
250afe61c15SRodney W. Grimesdisplays the current time in California.
251afe61c15SRodney W. GrimesSee
252afe61c15SRodney W. Grimes.Xr tzset 3
253afe61c15SRodney W. Grimesfor more information.
254afe61c15SRodney W. Grimes.It Ev USER
255afe61c15SRodney W. GrimesThe login name of the user.
2566d34415fSGordon BerglingIt is recommended that portable applications use
2576d34415fSGordon Bergling.Ev LOGNAME
2586d34415fSGordon Berglinginstead.
259afe61c15SRodney W. Grimes.El
260afe61c15SRodney W. Grimes.Pp
261afe61c15SRodney W. GrimesFurther names may be placed in the environment by the
262f06471d4SPhilippe Charnier.Ic export
263afe61c15SRodney W. Grimescommand and
264afe61c15SRodney W. Grimes.Ar name=value
265afe61c15SRodney W. Grimesarguments in
266afe61c15SRodney W. Grimes.Xr sh 1 ,
267afe61c15SRodney W. Grimesor by the
268f06471d4SPhilippe Charnier.Ic setenv
269afe61c15SRodney W. Grimescommand if you use
270afe61c15SRodney W. Grimes.Xr csh 1 .
271afe61c15SRodney W. GrimesIt is unwise to change certain
272afe61c15SRodney W. Grimes.Xr sh 1
273afe61c15SRodney W. Grimesvariables that are frequently exported by
274afe61c15SRodney W. Grimes.Pa .profile
275afe61c15SRodney W. Grimesfiles, such as
276afe61c15SRodney W. Grimes.Ev MAIL ,
277afe61c15SRodney W. Grimes.Ev PS1 ,
278afe61c15SRodney W. Grimes.Ev PS2 ,
279afe61c15SRodney W. Grimesand
280afe61c15SRodney W. Grimes.Ev IFS ,
281afe61c15SRodney W. Grimesunless you know what you are doing.
282f87fc6e3SGiorgos Keramidas.Pp
283f87fc6e3SGiorgos KeramidasThe current environment variables can be printed with
284f87fc6e3SGiorgos Keramidas.Xr env 1 ,
285f87fc6e3SGiorgos Keramidas.Xr set 1
286f87fc6e3SGiorgos Keramidasor
287f87fc6e3SGiorgos Keramidas.Xr printenv 1
288f87fc6e3SGiorgos Keramidasin
289f87fc6e3SGiorgos Keramidas.Xr sh 1
290f87fc6e3SGiorgos Keramidasand
291f87fc6e3SGiorgos Keramidas.Xr env 1 ,
292f87fc6e3SGiorgos Keramidas.Xr printenv 1
293f87fc6e3SGiorgos Keramidasor the
294f87fc6e3SGiorgos Keramidas.Cm printenv
295f87fc6e3SGiorgos Keramidasbuilt-in command in
296f87fc6e3SGiorgos Keramidas.Xr csh 1 .
297afe61c15SRodney W. Grimes.Sh SEE ALSO
298c15a12dfSWolfram Schneider.Xr cd 1 ,
299afe61c15SRodney W. Grimes.Xr csh 1 ,
300d0930e86SJens Schweikhardt.Xr env 1 ,
301afe61c15SRodney W. Grimes.Xr ex 1 ,
302afe61c15SRodney W. Grimes.Xr login 1 ,
303f87fc6e3SGiorgos Keramidas.Xr printenv 1 ,
304afe61c15SRodney W. Grimes.Xr sh 1 ,
305afe61c15SRodney W. Grimes.Xr execve 2 ,
306afe61c15SRodney W. Grimes.Xr execle 3 ,
307370cbbf2SGreg Lehey.Xr getbsize 3 ,
3086ae0d91aSBaptiste Daroussin.Xr getenv 3 ,
309e0a5f02bSMaxim Sobolev.Xr setenv 3 ,
3107c2aa513SAndrey A. Chernov.Xr setlocale 3 ,
311afe61c15SRodney W. Grimes.Xr system 3 ,
312afe61c15SRodney W. Grimes.Xr termcap 3 ,
313*d41afb81SRobert Clausecker.Xr termcap 5 ,
314*d41afb81SRobert Clausecker.Xr simd 7
315afe61c15SRodney W. Grimes.Sh HISTORY
316afe61c15SRodney W. GrimesThe
3174b66483fSRuslan Ermilov.Nm
318afe61c15SRodney W. Grimesmanual page appeared in
3198209febbSSergio Carlavilla Delgado.At v7 .
320