Linux

Where Is the Linux OS Version Stored?

Linux os-release file in /etc with distro name, version and IDs for scripts.

Last updated

Linux distributions identify themselves in /etc/os-release with name, version, IDs and URLs in shell-parseable format. Scripts source it to branch per distro instead of parsing lsb output.

Containers inherit the image's file, which is how you tell a Debian container on a Fedora host. Older releases symlink it for compatibility.

Where Linux stores this, by platform

Linux
/etc/os-release

Holds NAME, VERSION_ID, ID and variant fields every distro fills. Source it in scripts as . /etc/os-release for reliable distro detection. /usr/lib/os-release is the vendor original with /etc as the admin override.

Frequently asked questions

How do I check my Linux distro version?

Read the file above or run hostnamectl, which prints the same fields. Scripts should source the file rather than parse command output.

Why does a container report the wrong distro?

It reports its image's os-release, not the host's. That is correct behavior for the workload inside.

Notice an outdated path? Let us know.