xref: /dragonfly/share/man/man7/environ.7 (revision d9f85b33)
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: head/share/man/man7/environ.7 243117 2012-11-16 01:43:23Z grog $
30.\"
31.Dd November 24, 2013
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 ".Ev 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
156which may exploit special terminal capabilities.
157See
158.Pa /usr/share/misc/termcap
159.Pq Xr termcap 5
160for a list of terminal types.
161.It Ev TERMCAP
162The string describing the terminal in
163.Ev TERM ,
164or, if
165it begins with a '/', the name of the termcap file.
166See
167.Ev TERMPATH
168below, and
169.Xr termcap 5 .
170.It Ev TERMPATH
171A sequence of pathnames of termcap files, separated by colons or spaces,
172which are searched for terminal descriptions in the order listed.
173Having
174no
175.Ev TERMPATH
176is equivalent to a
177.Ev TERMPATH
178of
179.Dq Pa $HOME/.termcap:/etc/termcap .
180.Ev TERMPATH
181is ignored if
182.Ev TERMCAP
183contains a full pathname.
184.It Ev TMPDIR
185The directory in which to store temporary files.
186Most applications use either
187.Pa /tmp
188or
189.Pa /var/tmp .
190Setting this variable will make them use another directory.
191.It Ev TZ
192The timezone to use when displaying dates.
193The normal format is a pathname relative to
194.Dq Pa /usr/share/zoneinfo .
195For example, the command
196.Dq env TZ=America/Los_Angeles date
197displays the current time in California.
198See
199.Xr tzset 3
200for more information.
201.It Ev USER
202The login name of the user.
203.El
204.Pp
205Further names may be placed in the environment by the
206.Xr export 1
207command and
208.Ar name=value
209arguments in
210.Xr sh 1 ,
211or by the
212.Xr setenv 1
213command if you use
214.Xr csh 1 .
215It is unwise to change certain
216.Xr sh 1
217variables that are frequently exported by
218.Pa .profile
219files, such as
220.Ev MAIL ,
221.Ev PS1 ,
222.Ev PS2 ,
223and
224.Ev IFS ,
225unless you know what you are doing.
226.Pp
227The current environment variables can be printed with
228.Xr env 1 ,
229.Xr set 1
230or
231.Xr printenv 1
232in
233.Xr sh 1
234and
235.Xr env 1 ,
236.Xr printenv 1
237or the
238.Cm printenv
239built-in command in
240.Xr csh 1 .
241.Sh SEE ALSO
242.Xr cd 1 ,
243.Xr csh 1 ,
244.Xr env 1 ,
245.Xr ex 1 ,
246.Xr login 1 ,
247.Xr printenv 1 ,
248.Xr sh 1 ,
249.Xr execve 2 ,
250.Xr execle 3 ,
251.Xr getbsize 3 ,
252.Xr getenv 3 ,
253.Xr setenv 3 ,
254.Xr setlocale 3 ,
255.Xr system 3 ,
256.Xr termcap 3 ,
257.Xr termcap 5 ,
258.Xr nls 7
259.Sh HISTORY
260The
261.Nm
262manual page appeared in
263.Bx 4.2 .
264