xref: /openbsd/share/man/man7/environ.7 (revision 3cab2bb3)
1.\"	$OpenBSD: environ.7,v 1.22 2020/02/09 00:11:23 jsg Exp $
2.\"	$NetBSD: environ.7,v 1.4 1995/07/03 19:45:07 jtc Exp $
3.\"
4.\" Copyright (c) 1983, 1990, 1993
5.\"	The Regents of the University of California.  All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\" 3. Neither the name of the University nor the names of its contributors
16.\"    may be used to endorse or promote products derived from this software
17.\"    without specific prior written permission.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29.\" SUCH DAMAGE.
30.\"
31.\"	@(#)environ.7	8.3 (Berkeley) 4/19/94
32.\"
33.Dd $Mdocdate: February 9 2020 $
34.Dt ENVIRON 7
35.Os
36.Sh NAME
37.Nm environ
38.Nd user environment
39.Sh SYNOPSIS
40.Vt extern char **environ ;
41.Sh DESCRIPTION
42An array of strings called the
43.Dq environment
44is made available by
45.Xr execve 2
46when a process begins.
47By convention these strings have the form
48.Ar name Ns = Ns Ar value .
49The following variables are recognized by various commands:
50.Bl -tag -width BLOCKSIZE
51.It Ev BLOCKSIZE
52The size of the block units used by several commands, most notably
53.Xr df 1 ,
54.Xr du 1 ,
55and
56.Xr ls 1 .
57May be specified in units of a byte by specifying a number,
58in units of a kilobyte by specifying a number followed by
59.Sq K
60or
61.Sq k ,
62in units of a megabyte by specifying a number followed by
63.Sq M
64or
65.Sq m ,
66or in units of a gigabyte by specifying a number followed
67by
68.Sq G
69or
70.Sq g .
71Sizes less than 512 bytes or greater than a gigabyte are ignored.
72.It Ev EXINIT
73A list of startup commands read by
74.Xr ex 1
75and
76.Xr vi 1 .
77.It Ev HOME
78The user's login directory, set by
79.Xr login 1
80from the password file
81.Xr passwd 5 .
82.It Ev LOGNAME
83The login name of the user.
84.It Ev PATH
85The sequence of directories, separated by colons, searched by
86.Xr csh 1 ,
87.Xr sh 1 ,
88.Xr ksh 1 ,
89.Xr system 3 ,
90.Xr execvp 3 ,
91etc. when looking for an executable file.
92Initially set to the value of
93.Dv _PATH_DEFPATH
94by
95.Xr login 1 ,
96traditionally
97.Pa /usr/bin:/bin ,
98but expanded to include
99.Pa /usr/sbin ,
100.Pa /sbin ,
101.Pa /usr/X11R6/bin ,
102.Pa /usr/local/bin ,
103and
104.Pa /usr/local/sbin
105in
106.Ox .
107.It Ev PRINTER
108The name of the default printer to be used by
109.Xr lpq 1 ,
110.Xr lpr 1 ,
111and
112.Xr lprm 1 .
113.It Ev PWD
114The current working directory.
115.It Ev SHELL
116The full pathname of the user's login shell.
117.It Ev TERM
118The kind of terminal for which output is to be prepared.
119This information is used by commands such as
120.Xr mandoc 1
121which may exploit special terminal capabilities.
122See
123.Pa /usr/share/misc/termcap
124.Pq Xr termcap 5
125for a list of terminal types.
126.It Ev TERMCAP
127The string describing the terminal in
128.Ev TERM ,
129or, if it begins with a
130.Ql / ,
131the name of the termcap file.
132See
133.Ev TERMPATH
134below,
135.Xr termcap 5 ,
136and
137.Xr termcap 3 .
138.It Ev TERMPATH
139A sequence of pathnames of termcap files, separated by colons or spaces,
140which are searched for terminal descriptions in the order listed.
141Having no
142.Ev TERMPATH
143is equivalent to a
144.Ev TERMPATH
145of
146.Pa $HOME/.termcap:/etc/termcap .
147.Ev TERMPATH
148is ignored if
149.Ev TERMCAP
150contains a full pathname.
151.It Ev TMPDIR
152The directory in which to store temporary files.
153Most applications use either
154.Pa /tmp
155or
156.Pa /var/tmp .
157Setting this variable will make them use another directory.
158.It Ev TZ
159The time zone to use when displaying dates.
160The normal format is a pathname relative to
161.Pa /usr/share/zoneinfo .
162For example, the command
163.Ic env TZ=America/Los_Angeles date
164displays the current time in California.
165See
166.Xr tzset 3
167for more information.
168.It Ev USER
169Deprecated synonym of
170.Ev LOGNAME
171(for backwards compatibility).
172.El
173.Pp
174Further names may be placed in the environment by the
175.Ic export
176command and
177.Ar name Ns = Ns Ar value
178arguments in
179.Xr sh 1 ,
180or by the
181.Ic setenv
182command if you use
183.Xr csh 1 .
184It is unwise to change certain
185.Xr sh 1
186variables that are frequently exported by
187.Pa .profile
188files, such as
189.Ev MAIL ,
190.Ev PS1 ,
191.Ev PS2 ,
192and
193.Ev IFS ,
194unless you know what you are doing.
195.Pp
196The current environment variables can be printed with
197.Xr env 1
198or
199.Xr printenv 1 .
200.Sh SEE ALSO
201.Xr csh 1 ,
202.Xr env 1 ,
203.Xr ex 1 ,
204.Xr login 1 ,
205.Xr printenv 1 ,
206.Xr sh 1 ,
207.Xr execve 2 ,
208.Xr execle 3 ,
209.Xr getenv 3 ,
210.Xr system 3 ,
211.Xr termcap 3 ,
212.Xr tzset 3 ,
213.Xr termcap 5
214.Sh HISTORY
215An
216.Nm
217manual page appeared in
218.At v7 .
219