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