xref: /openbsd/share/man/man7/environ.7 (revision 6ae84a2d)
1*6ae84a2dSjsg.\"	$OpenBSD: environ.7,v 1.22 2020/02/09 00:11:23 jsg Exp $
2df930be7Sderaadt.\"	$NetBSD: environ.7,v 1.4 1995/07/03 19:45:07 jtc Exp $
3df930be7Sderaadt.\"
4df930be7Sderaadt.\" Copyright (c) 1983, 1990, 1993
5df930be7Sderaadt.\"	The Regents of the University of California.  All rights reserved.
6df930be7Sderaadt.\"
7df930be7Sderaadt.\" Redistribution and use in source and binary forms, with or without
8df930be7Sderaadt.\" modification, are permitted provided that the following conditions
9df930be7Sderaadt.\" are met:
10df930be7Sderaadt.\" 1. Redistributions of source code must retain the above copyright
11df930be7Sderaadt.\"    notice, this list of conditions and the following disclaimer.
12df930be7Sderaadt.\" 2. Redistributions in binary form must reproduce the above copyright
13df930be7Sderaadt.\"    notice, this list of conditions and the following disclaimer in the
14df930be7Sderaadt.\"    documentation and/or other materials provided with the distribution.
1529295d1cSmillert.\" 3. Neither the name of the University nor the names of its contributors
16df930be7Sderaadt.\"    may be used to endorse or promote products derived from this software
17df930be7Sderaadt.\"    without specific prior written permission.
18df930be7Sderaadt.\"
19df930be7Sderaadt.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20df930be7Sderaadt.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21df930be7Sderaadt.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22df930be7Sderaadt.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23df930be7Sderaadt.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24df930be7Sderaadt.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25df930be7Sderaadt.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26df930be7Sderaadt.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27df930be7Sderaadt.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28df930be7Sderaadt.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29df930be7Sderaadt.\" SUCH DAMAGE.
30df930be7Sderaadt.\"
31df930be7Sderaadt.\"	@(#)environ.7	8.3 (Berkeley) 4/19/94
32df930be7Sderaadt.\"
33*6ae84a2dSjsg.Dd $Mdocdate: February 9 2020 $
34df930be7Sderaadt.Dt ENVIRON 7
35fc8533a3Saaron.Os
36df930be7Sderaadt.Sh NAME
37df930be7Sderaadt.Nm environ
38df930be7Sderaadt.Nd user environment
39df930be7Sderaadt.Sh SYNOPSIS
40837c2d5cSschwarze.Vt extern char **environ ;
41df930be7Sderaadt.Sh DESCRIPTION
42df930be7SderaadtAn array of strings called the
43230f84baSaaron.Dq environment
44df930be7Sderaadtis made available by
45df930be7Sderaadt.Xr execve 2
461f53fde1Saaronwhen a process begins.
471f53fde1SaaronBy convention these strings have the form
48d741230eSjmc.Ar name Ns = Ns Ar value .
4998d3582bSaaronThe following variables are recognized by various commands:
50df930be7Sderaadt.Bl -tag -width BLOCKSIZE
51df930be7Sderaadt.It Ev BLOCKSIZE
52df930be7SderaadtThe size of the block units used by several commands, most notably
53df930be7Sderaadt.Xr df 1 ,
5498d3582bSaaron.Xr du 1 ,
55df930be7Sderaadtand
56df930be7Sderaadt.Xr ls 1 .
5798d3582bSaaronMay be specified in units of a byte by specifying a number,
58230f84baSaaronin units of a kilobyte by specifying a number followed by
5998d3582bSaaron.Sq K
60230f84baSaaronor
6198d3582bSaaron.Sq k ,
62230f84baSaaronin units of a megabyte by specifying a number followed by
6398d3582bSaaron.Sq M
64230f84baSaaronor
6598d3582bSaaron.Sq m ,
6698d3582bSaaronor in units of a gigabyte by specifying a number followed
67230f84baSaaronby
6898d3582bSaaron.Sq G
69230f84baSaaronor
7098d3582bSaaron.Sq g .
71df930be7SderaadtSizes less than 512 bytes or greater than a gigabyte are ignored.
72df930be7Sderaadt.It Ev EXINIT
7398d3582bSaaronA list of startup commands read by
7498d3582bSaaron.Xr ex 1
75df930be7Sderaadtand
76df930be7Sderaadt.Xr vi 1 .
77df930be7Sderaadt.It Ev HOME
7854d6e335SaaronThe user's login directory, set by
79df930be7Sderaadt.Xr login 1
80df930be7Sderaadtfrom the password file
81df930be7Sderaadt.Xr passwd 5 .
8254d6e335Saaron.It Ev LOGNAME
8354d6e335SaaronThe login name of the user.
84df930be7Sderaadt.It Ev PATH
85df930be7SderaadtThe sequence of directories, separated by colons, searched by
86df930be7Sderaadt.Xr csh 1 ,
87df930be7Sderaadt.Xr sh 1 ,
8898d3582bSaaron.Xr ksh 1 ,
89df930be7Sderaadt.Xr system 3 ,
90df930be7Sderaadt.Xr execvp 3 ,
91230f84baSaaronetc. when looking for an executable file.
9298d3582bSaaronInitially set to the value of
9398d3582bSaaron.Dv _PATH_DEFPATH
94230f84baSaaronby
9598d3582bSaaron.Xr login 1 ,
9698d3582bSaarontraditionally
9798d3582bSaaron.Pa /usr/bin:/bin ,
9898d3582bSaaronbut expanded to include
9998d3582bSaaron.Pa /usr/sbin ,
10098d3582bSaaron.Pa /sbin ,
10198d3582bSaaron.Pa /usr/X11R6/bin ,
1028c74b6a9Sokan.Pa /usr/local/bin ,
10398d3582bSaaronand
1048c74b6a9Sokan.Pa /usr/local/sbin
10598d3582bSaaronin
10698d3582bSaaron.Ox .
107df930be7Sderaadt.It Ev PRINTER
108df930be7SderaadtThe name of the default printer to be used by
109df930be7Sderaadt.Xr lpq 1 ,
110230f84baSaaron.Xr lpr 1 ,
111df930be7Sderaadtand
112df930be7Sderaadt.Xr lprm 1 .
11398d3582bSaaron.It Ev PWD
11498d3582bSaaronThe current working directory.
115df930be7Sderaadt.It Ev SHELL
116df930be7SderaadtThe full pathname of the user's login shell.
117df930be7Sderaadt.It Ev TERM
118df930be7SderaadtThe kind of terminal for which output is to be prepared.
119230f84baSaaronThis information is used by commands such as
1203e3f2be6Sjmc.Xr mandoc 1
12198d3582bSaaronwhich may exploit special terminal capabilities.
12298d3582bSaaronSee
123df930be7Sderaadt.Pa /usr/share/misc/termcap
124df930be7Sderaadt.Pq Xr termcap 5
125df930be7Sderaadtfor a list of terminal types.
126df930be7Sderaadt.It Ev TERMCAP
12798d3582bSaaronThe string describing the terminal in
12898d3582bSaaron.Ev TERM ,
12998d3582bSaaronor, if it begins with a
13098d3582bSaaron.Ql / ,
131230f84baSaaronthe name of the termcap file.
132df930be7SderaadtSee
133df930be7Sderaadt.Ev TERMPATH
134df930be7Sderaadtbelow,
135df930be7Sderaadt.Xr termcap 5 ,
136df930be7Sderaadtand
1378009c66aSmpech.Xr termcap 3 .
138df930be7Sderaadt.It Ev TERMPATH
139df930be7SderaadtA sequence of pathnames of termcap files, separated by colons or spaces,
1401f53fde1Saaronwhich are searched for terminal descriptions in the order listed.
1411f53fde1SaaronHaving no
142df930be7Sderaadt.Ev TERMPATH
143df930be7Sderaadtis equivalent to a
144df930be7Sderaadt.Ev TERMPATH
145df930be7Sderaadtof
14698d3582bSaaron.Pa $HOME/.termcap:/etc/termcap .
147df930be7Sderaadt.Ev TERMPATH
148df930be7Sderaadtis ignored if
149df930be7Sderaadt.Ev TERMCAP
150df930be7Sderaadtcontains a full pathname.
151df930be7Sderaadt.It Ev TMPDIR
152df930be7SderaadtThe directory in which to store temporary files.
153df930be7SderaadtMost applications use either
154230f84baSaaron.Pa /tmp
155df930be7Sderaadtor
156230f84baSaaron.Pa /var/tmp .
157df930be7SderaadtSetting this variable will make them use another directory.
158df930be7Sderaadt.It Ev TZ
159df930be7SderaadtThe time zone to use when displaying dates.
160df930be7SderaadtThe normal format is a pathname relative to
161230f84baSaaron.Pa /usr/share/zoneinfo .
162df930be7SderaadtFor example, the command
1633f20e2fbSjmc.Ic env TZ=America/Los_Angeles date
164df930be7Sderaadtdisplays the current time in California.
165df930be7SderaadtSee
166df930be7Sderaadt.Xr tzset 3
167df930be7Sderaadtfor more information.
16822b0a796Smillert.It Ev USER
16922b0a796SmillertDeprecated synonym of
17022b0a796Smillert.Ev LOGNAME
17122b0a796Smillert(for backwards compatibility).
172df930be7Sderaadt.El
173df930be7Sderaadt.Pp
174df930be7SderaadtFurther names may be placed in the environment by the
17554d6e335Saaron.Ic export
176df930be7Sderaadtcommand and
177d741230eSjmc.Ar name Ns = Ns Ar value
178df930be7Sderaadtarguments in
179df930be7Sderaadt.Xr sh 1 ,
180df930be7Sderaadtor by the
18198d3582bSaaron.Ic setenv
182df930be7Sderaadtcommand if you use
183df930be7Sderaadt.Xr csh 1 .
184df930be7SderaadtIt is unwise to change certain
185df930be7Sderaadt.Xr sh 1
186df930be7Sderaadtvariables that are frequently exported by
187df930be7Sderaadt.Pa .profile
188df930be7Sderaadtfiles, such as
189df930be7Sderaadt.Ev MAIL ,
190df930be7Sderaadt.Ev PS1 ,
191df930be7Sderaadt.Ev PS2 ,
192df930be7Sderaadtand
193df930be7Sderaadt.Ev IFS ,
194df930be7Sderaadtunless you know what you are doing.
1952c1e0a6cSjmc.Pp
1962c1e0a6cSjmcThe current environment variables can be printed with
1972c1e0a6cSjmc.Xr env 1
1982c1e0a6cSjmcor
1992c1e0a6cSjmc.Xr printenv 1 .
200df930be7Sderaadt.Sh SEE ALSO
201df930be7Sderaadt.Xr csh 1 ,
20298d3582bSaaron.Xr env 1 ,
203df930be7Sderaadt.Xr ex 1 ,
204df930be7Sderaadt.Xr login 1 ,
2052c1e0a6cSjmc.Xr printenv 1 ,
206df930be7Sderaadt.Xr sh 1 ,
207df930be7Sderaadt.Xr execve 2 ,
208df930be7Sderaadt.Xr execle 3 ,
209ea90ff16Sjmc.Xr getenv 3 ,
210df930be7Sderaadt.Xr system 3 ,
211df930be7Sderaadt.Xr termcap 3 ,
21298d3582bSaaron.Xr tzset 3 ,
213df930be7Sderaadt.Xr termcap 5
214df930be7Sderaadt.Sh HISTORY
215*6ae84a2dSjsgAn
216230f84baSaaron.Nm
217df930be7Sderaadtmanual page appeared in
218*6ae84a2dSjsg.At v7 .
219