os-release
systemd
Developer
Lennart
Poettering
lennart@poettering.net
os-release
5
os-release
Operating system identification
/etc/os-release
Description
The /etc/os-release file
contains operating system identification data.
The basic file format of
os-release is a
newline-separated list of environment-like
shell-compatible variable assignments. It is possible
to source the configuration from shell scripts,
however, beyond mere variable assignments no shell
features are supported, allowing applications to read
the file without implementing a shell compatible
execution engine.
/etc/os-release contains
data that is defined by the operating system vendor
and should not be changed by the administrator.
Depending on the operating system other
configuration files might be checked for OS
identification as well, however only as
fallback.
Options
The following OS identifications parameters may be set using
/etc/os-release:
NAME=
A string identifying
the operating system, without a
version string, and not necessarily
suitable for presentation to the
user. If not set defaults to
Linux. Example:
NAME=Fedora or
NAME="Debian
GNU/Linux".
VERSION=
A string identifying
the operating system version,
excluding any name information and
suitable for presentation to the
user. Example:
VERSION=15 or
VERSION="15
(Rawhide)".
ID=
A lower-case string
identifying the operating system,
excluding any version information and
suitable for processing by scripts. If
not set defaults to
linux. Example:
ID=fedora.
VERSION_ID=
A lower-case string
(mostly numeric) identifying the
operating system version, excluding
any name information and suitable for
processing by scripts. Example:
VERSION_ID=15.
PRETTY_NAME=
A pretty operating
system name in a format suitable for
presentation to the user. May or may
not contain an OS version of some
kind, as suitable. If not set defaults
to Linux. Example:
PRETTY_NAME=Fedora 15
(Rawhide).
ANSI_COLOR=
A suggested
presentation color when showing the
distribution name on the console. This
should be specified as string suitable
for inclusion in the ESC [ m
ANSI/ECMA-48 escape code for setting
graphical rendition. Example:
ANSI_COLOR=0;31 for
red, or
ANSI_COLOR=1;34 for
light blue.
If you interpreting this file from code or a
shell script, use the ID and VERSION_ID fields. When
looking for an OS identification string for
presentation to the user use the PRETTY_STRING
field.
Note that operating system vendors may choose
not to provide version information, for example to
accommodate for rolling releases. In this case VERSION
and VERSION_ID may be unset. Applications should not
rely on these fields to be set.
Example
NAME=Fedora
VERSION=15 (Rawhide)
ID=fedora
VERSION_ID=15
PRETTY_NAME=Fedora 15 (Rawhide)
ANSI_COLOR=0;34
See Also
systemd1,
lsb_release1