xref: /openbsd-src/share/man/man7/environ.7 (revision 91f110e064cd7c194e59e019b83bb7496c1c84d4)
1.\"	$OpenBSD: environ.7,v 1.18 2010/10/28 17:55:04 jmc 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: October 28 2010 $
34.Dt ENVIRON 7
35.Os
36.Sh NAME
37.Nm environ
38.Nd user environment
39.Sh SYNOPSIS
40.Ar 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 ,
102and
103.Pa /usr/local/bin
104in
105.Ox .
106.It Ev PRINTER
107The name of the default printer to be used by
108.Xr lpq 1 ,
109.Xr lpr 1 ,
110and
111.Xr lprm 1 .
112.It Ev PWD
113The current working directory.
114.It Ev SHELL
115The full pathname of the user's login shell.
116.It Ev TERM
117The kind of terminal for which output is to be prepared.
118This information is used by commands such as
119.Xr mandoc 1
120which may exploit special terminal capabilities.
121See
122.Pa /usr/share/misc/termcap
123.Pq Xr termcap 5
124for a list of terminal types.
125.It Ev TERMCAP
126The string describing the terminal in
127.Ev TERM ,
128or, if it begins with a
129.Ql / ,
130the name of the termcap file.
131See
132.Ev TERMPATH
133below,
134.Xr termcap 5 ,
135and
136.Xr termcap 3 .
137.It Ev TERMPATH
138A sequence of pathnames of termcap files, separated by colons or spaces,
139which are searched for terminal descriptions in the order listed.
140Having no
141.Ev TERMPATH
142is equivalent to a
143.Ev TERMPATH
144of
145.Pa $HOME/.termcap:/etc/termcap .
146.Ev TERMPATH
147is ignored if
148.Ev TERMCAP
149contains a full pathname.
150.It Ev TMPDIR
151The directory in which to store temporary files.
152Most applications use either
153.Pa /tmp
154or
155.Pa /var/tmp .
156Setting this variable will make them use another directory.
157.It Ev TZ
158The time zone to use when displaying dates.
159The normal format is a pathname relative to
160.Pa /usr/share/zoneinfo .
161For example, the command
162.Ic env TZ=US/Pacific date
163displays the current time in California.
164See
165.Xr tzset 3
166for more information.
167.It Ev USER
168Deprecated synonym of
169.Ev LOGNAME
170(for backwards compatibility).
171.El
172.Pp
173Further names may be placed in the environment by the
174.Ic export
175command and
176.Ar name Ns = Ns Ar value
177arguments in
178.Xr sh 1 ,
179or by the
180.Ic setenv
181command if you use
182.Xr csh 1 .
183It is unwise to change certain
184.Xr sh 1
185variables that are frequently exported by
186.Pa .profile
187files, such as
188.Ev MAIL ,
189.Ev PS1 ,
190.Ev PS2 ,
191and
192.Ev IFS ,
193unless you know what you are doing.
194.Pp
195The current environment variables can be printed with
196.Xr env 1
197or
198.Xr printenv 1 .
199.Sh SEE ALSO
200.Xr csh 1 ,
201.Xr env 1 ,
202.Xr ex 1 ,
203.Xr login 1 ,
204.Xr printenv 1 ,
205.Xr sh 1 ,
206.Xr execve 2 ,
207.Xr execle 3 ,
208.Xr getenv 3 ,
209.Xr system 3 ,
210.Xr termcap 3 ,
211.Xr tzset 3 ,
212.Xr termcap 5
213.Sh HISTORY
214The
215.Nm
216manual page appeared in
217.Bx 4.2 .
218