environment File

Purpose

Sets up the user environment.

Description

The /etc/environment file contains variables specifying the basic environment for all processes. When a new process begins, the exec subroutine makes an array of strings available that have the form Name=Value. This array of strings is called the environment. Each name defined by one of the strings is called an environment variable or shell variable. The exec subroutine allows the entire environment to be set at one time.

Environment variables are examined when a command starts running. The environment of a process is not changed by altering the /etc/environment file. Any processes that were started prior to the change to the /etc/environment file must be restarted if the change is to take effect for those processes. If the TZ variable is changed, the cron daemon must be restarted, because this variable is used to determine the current local time.

The following restrictions apply, when modifying the environment file:

The Basic Environment

When you log in, the system sets environment variables from the environment file before reading your login profile, .profile.

The following variables make up the basic environment:

Variable Description
HOME The full path name of the user login or HOME directory. The login program sets this to the name specified in the /etc/passwd file.
LANG The locale name currently in effect. The LANG variable is set in the /etc/environment file at installation time.
NLSPATH The full path name for message catalogs. The default is:

/usr/lib/nls/msg/%L/%N:

/usr/lib/nls/msg/%L/%N.cat:

where %L is the value of the LC_MESSAGES category and %N is the catalog file name.
Note: See the chlang command for more information about changing message catalogs.
LC__FASTMSG If LC_FASTMEG is set to false, POSIX-compliant message handling is performed. If LC__FASTMSG is set to true, it specifies that default messages should be used for the C and POSIX locales and that NLSPATH is ignored. If this variable is set to anything other than false or unset, it is considered the same as being set to true. The default value is LC__FASTMSG=true in the /etc/environment file.
LOCPATH The full path name of the location of National Language Support tables. The default is /usr/lib/nls/loc and is set in the /etc/profile file. If the LOCPATH variable is a null value, it assumes that the current directory contains the locale files.
Note: All setuid and setgid programs will ignore the LOCPATH environment variable.
PATH The sequence of directories that commands such as the sh, time, nice and nohup commands search when looking for a command whose path name is incomplete. The directory names are separated by colons.
TZ The time-zone information. The TZ environment variable is set by the /etc/environment file. The TZ environment variable has the following format (spaces inserted for readability):
std offset dst offset , rule

The fields within the TZ environment variable are defined as follows:

std and dst
Designate the standard (std) and summer (dst) time zones. Only the std value along with the appropriate offset value is required. If the dst value is not specified, summer time does not apply. The values specified may be no less than three and no more than TZNAME_MAX bytes in length. The length of the variables corresponds to the %Z field of the date command; for libc and libbsd, TZNAME_MAX equals three characters. Any nonnumeric ASCII characters except the following may be entered into each field: a leading : (colon), a , (comma), a - (minus sign), a + (plus sign), or the ASCII null character.
Note: POSIX 1.0 reserves the leading : (colon) for an implementation-defined TZ specification. The operating system disallows the leading colon, selecting CUT0 and setting the %Z field to a null string.

An example of std and dst format is as follows:

EST5EDT 
Note: If the value set is invalid or unrecognized, the time zone defaults to UTC/GMT.
EST Specifies Eastern U.S. standard time.
5 Specifies the offset, which is 5 hours behind Coordinated Universal Time (CUT).
EDT
Specifies the corresponding summer time zone abbreviation.
Note: See "Time Zones" for a list of time zone names defined for the system.
offset
Denotes the value added to local time to equal Coordinated Universal Time (CUT). CUT is the international time standard that has largely replaced Greenwich Mean Time. The offset variable has the following format:
hh:mm:ss

The fields within the offset variable are defined as follows:

hh Specifies the dst offset in hours. This field is required. The hh value can range between the integers -12 and +11. A negative value indicates the time zone is east of the prime meridian; a positive value or no value indicates the time zone is west of the prime meridian.
mm Specifies the dst offset detailed to the minute. This field is optional. If the mm value is present, it must be specified between 0 and 59 and preceded by a : (colon).
ss
Specifies the dst offset detailed to the second. The ss field is optional. If the ss value is present, it must be specified between 0 and 59 and preceded by a : (colon).

An offset variable must be specified with the std variable. An offset variable for the dst variable is optional. If no offset is specified with the dst variable, the system assumes that summer time is one hour ahead of standard time.

As an example of offset syntax, Zurich is one hour ahead of CUT, so its offset is -1. Newfoundland is 1.5 hours ahead of eastern U.S. standard time zones. Its syntax can be stated as any of the following: 3:30, 03:30, +3:30, or 3:30:00.

rule
The rule variable indicates when to change to and back from summer time. The rule variable has the following format:
start/time,end/time

The fields within the rule variable are defined as follows:

start Specifies the change from standard to summer time.
end Specifies the return to standard time from summer time.
time Specifies when the time changes occur within the time zone. For example, if the time variable is encoded for 2 a.m. then the time changes when the time zone reaches 2 a.m. on the date specified in the start variable.
/ Delimits the start date, end date, and time variables.
,
(Comma) Delimits two date and time pairs.
The start and end variables support a syntax for Julian time (J) and a syntax for leap years (M):
Jn
Mm.n.d

In the J syntax, the n variable has the value of 1 through 365. Leap days are not counted. In the M syntax, m is the month, n the week, and d the day of the week starting from day 0 (Sunday).

The rule variable has the same format as the offset variable except no leading - (minus sign) or + (plus sign) is allowed. The default of the start variable is 02:00:00 (2 a.m.).
Note: The time zone offsets and time change points are interrelated and context-dependent. The rule variable's runtime execution semantics change as a function of the offsets. For example, if the summer time zone changes one hour, as in CST6CDT5, (the default 2 a.m.) summer time changes instantaneously from 2 a.m. to 3 a.m. CDT. The fall change is from 2 a.m. CDT to 1 a.m. CST. The respective changes for a time zone of CST6CDT4 are 2 a.m. CST to 4 a.m. CDT and 2 a.m. CDT to 12 a.m. CST.

In an example of the rule variable, if the law changed so that the Central United States experienced summer time between Julian 129 and Julian 131, the TZ variable would be stated as follows:

TZ=CST6CDT5,J129,J131

In this example, the dates indicated are May 09 and May 11,1993, respectively. (Use the date +%j command to get the Julian date number.)

In another example, if the time changes were to occur at 2 a.m. CST and 19:30 CDT, respectively, the variables would be stated as follows:

TZ=CST6CDT5,J129,J131/19:30

In nonleap years, the fallback time change would be from 19:30 CDT to 18:30 CST on May 11 (1993).

For the leap year (M) syntax, the spring ahead date would be 2 May and the fallback date is 9 May. The variables are stated as follows:

TZ=CST6CDT5,M5.1.0,M5.2.0

Time Zones

The system defines the following time zones and time zone names:

Note: Coordinated Universal Time (CUT) is the international time standard.
Table 1. Time Zones Defined on the System
Name Time Zone CUT Offset
CUT0GDT Coordinated Universal Time CUT
GMT0BST United Kingdom CUT
WET0WEST Western Europe CUT
AZOREST1AZOREDT Azores, Cape Verde CUT -1
FALKST2FALKDT Falkland Islands CUT -2
GRNLNDST3GRNLNDDT Greenland, East Brazil CUT -3
AST4ADT Central Brazil CUT -4
EST5EDT Eastern United States, Colombia CUT -4
CST6CDT Central United States, Honduras CUT -6
MST7MDT Mountain United States CUT -7
PST8PDT Pacific United States, Yukon CUT -8
AST9ADT Alaska CUT -9
HST10HDT Hawaii, Aleutian Islands CUT -10
BST11BDT Bering Strait CUT -11
NZST-12NZDT New Zealand CUT +12
Item Description
MET-11METDT Solomon Islands CUT +11
EET-10EETDT Eastern Australia CUT +10
JST-9JSTDT Japan CUT +9
KORST-9KORDT Korea CUT +9
WAUST-8WAUDT Western Australia CUT +8
TAIST-8TAIDT Taiwan CUT +8
THAIST-7THAIDT Thailand CUT +7
TASHST-6TASHDT Central Asia CUT +6
PAKST-5PAKDT Pakistan CUT +5
WST-4WDT Gorki, Central Asia, Oman CUT +4
MEST-3MEDT Turkey CUT +3
SAUST-3SAUDT Saudi Arabia CUT +3
EET-2EEST Eastern Europe CUT +2
USAST-2USADT South Africa CUT +2
CET-1CEST Central Europe CUT +1

Files

Item Description
/etc/profile Specifies variables to be added to the environment by the shell.
/etc/environment Specifies the basic environment for all processes.
$HOME/.profile Specifies the environment for specific user needs.
/etc/passwd Specifies user IDs.