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