xref: /freebsd/share/man/man7/environ.7 (revision f05cddf9)
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 .
59This variable is processed by the
60.Xr getbsize 3
61function.
62.It Ev COLUMNS
63The user's preferred width in column positions for the terminal.
64Utilities such as
65.Xr ls 1
66and
67.Xr who 1
68use this to format output into columns.
69If unset or empty, utilities will use an
70.Xr ioctl 2
71call to ask the terminal driver for the width.
72.It Ev EDITOR
73Default editor name.
74.It Ev EXINIT
75A startup list of commands read by
76.Xr ex 1
77and
78.Xr vi 1 .
79.It Ev HOME
80A user's login directory, set by
81.Xr login 1
82from the password file
83.Xr passwd 5 .
84.It Ev LANG
85This variable configures all programs which use
86.Xr setlocale 3
87to use the specified locale unless the
88.Ev LC_*
89variables are set.
90.It Ev LC_ALL
91Overrides the values of
92.Ev LC_COLLATE ,
93.Ev LC_CTYPE ,
94.Ev LC_MESSAGES ,
95.Ev LC_MONETARY ,
96.Ev LC_NUMERIC ,
97.Ev LC_TIME
98and
99.Ev LANG .
100.It Ev LC_COLLATE
101Locale to be used for ordering of strings.
102.It Ev LC_CTYPE
103Locale to be used for character classification
104(letter, space, digit, etc.) and for interpreting byte sequences as
105multibyte characters.
106.It Ev LC_MESSAGES
107Locale to be used for diagnostic messages.
108.It Ev LC_MONETARY
109Locale to be used for interpreting monetary input
110and formatting output.
111.It Ev LC_NUMERIC
112Locale to be used for interpreting numeric input and
113formatting output.
114.It Ev LC_TIME
115Locale to be used for interpreting dates input and
116for formatting output.
117.It Ev MAIL
118The location of the user's
119mailbox instead of the default in /var/mail,
120used by
121.Xr mail 1 ,
122.Xr sh 1 ,
123and many other mail clients.
124.It Ev NLSPATH
125List of directories to be searched for the message catalog referred to by
126.Ev LC_MESSAGES .
127See
128.Xr catopen 3 .
129.It Ev PAGER
130Default paginator program.
131The program specified by this variable is used by
132.Xr mail 1 ,
133.Xr man 1 ,
134.Xr ftp 1 ,
135etc, to display information which is longer than the current display.
136.It Ev PATH
137The sequence of directories, separated by colons, searched by
138.Xr csh 1 ,
139.Xr sh 1 ,
140.Xr system 3 ,
141.Xr execvp 3 ,
142etc, when looking for an executable file.
143.Ev PATH
144is set to ``/usr/bin:/bin'' initially by
145.Xr login 1 .
146.It Ev PRINTER
147The name of the default printer to be used by
148.Xr lpr 1 ,
149.Xr lpq 1 ,
150and
151.Xr lprm 1 .
152.It Ev PWD
153The current directory pathname.
154.It Ev SHELL
155The full pathname of the user's login shell.
156.It Ev TERM
157The kind of terminal for which output is to be prepared.
158This information is used by commands, such as
159.Xr nroff 1
160or
161.Xr plot 1
162which may exploit special terminal capabilities.
163See
164.Pa /usr/share/misc/termcap
165.Pq Xr termcap 5
166for a list of terminal types.
167.It Ev TERMCAP
168The string describing the terminal in
169.Ev TERM ,
170or, if
171it begins with a '/', the name of the termcap file.
172See
173.Ev TERMPATH
174below, and
175.Xr termcap 5 .
176.It Ev TERMPATH
177A sequence of pathnames of termcap files, separated by colons or spaces,
178which are searched for terminal descriptions in the order listed.
179Having
180no
181.Ev TERMPATH
182is equivalent to a
183.Ev TERMPATH
184of
185.Dq Pa $HOME/.termcap:/etc/termcap .
186.Ev TERMPATH
187is ignored if
188.Ev TERMCAP
189contains a full pathname.
190.It Ev TMPDIR
191The directory in which to store temporary files.
192Most applications use either
193.Dq /tmp
194or
195.Dq /var/tmp .
196Setting this variable will make them use another directory.
197.It Ev TZ
198The timezone to use when displaying dates.
199The normal format is a pathname relative to
200.Dq Pa /usr/share/zoneinfo .
201For example, the command
202.Dq env TZ=America/Los_Angeles date
203displays the current time in California.
204See
205.Xr tzset 3
206for more information.
207.It Ev USER
208The login name of the user.
209.El
210.Pp
211Further names may be placed in the environment by the
212.Ic export
213command and
214.Ar name=value
215arguments in
216.Xr sh 1 ,
217or by the
218.Ic setenv
219command if you use
220.Xr csh 1 .
221It is unwise to change certain
222.Xr sh 1
223variables that are frequently exported by
224.Pa .profile
225files, such as
226.Ev MAIL ,
227.Ev PS1 ,
228.Ev PS2 ,
229and
230.Ev IFS ,
231unless you know what you are doing.
232.Pp
233The current environment variables can be printed with
234.Xr env 1 ,
235.Xr set 1
236or
237.Xr printenv 1
238in
239.Xr sh 1
240and
241.Xr env 1 ,
242.Xr printenv 1
243or the
244.Cm printenv
245built-in command in
246.Xr csh 1 .
247.Sh SEE ALSO
248.Xr cd 1 ,
249.Xr csh 1 ,
250.Xr env 1 ,
251.Xr ex 1 ,
252.Xr login 1 ,
253.Xr printenv 1 ,
254.Xr sh 1 ,
255.Xr execve 2 ,
256.Xr execle 3 ,
257.Xr getenv 3 ,
258.Xr getbsize 3 ,
259.Xr setenv 3 ,
260.Xr setlocale 3 ,
261.Xr system 3 ,
262.Xr termcap 3 ,
263.Xr termcap 5
264.Sh HISTORY
265The
266.Nm
267manual page appeared in
268.Bx 4.2 .
269