Check OS Version

From Exterior Memory
Jump to: navigation, search


It is often easy to determine the kernel of a running computer.

uname -v

cat /proc/version

This only works on a running computer, not a mounted file system (so you can't easily determine the version from an installer DVD without actually installing it). In addition, it only lists the kernel, not the distribution. For example, the result of uname -sr on Mac OS X 10.5.5 is Darwin 9.5.2.

The following examples may help you get more information.

Linux Distributions

There is a convention to include version information in file in the /etc/ directory:

Distribution File
Debian /etc/debian_version
Fedora /etc/fedora-release
Mandrake /etc/mandrake-release
Red Hat /etc/redhat-release
Slackware /etc/slackware-version
SUSE /etc/SuSE-release
United Linux /etc/UnitedLinux-release

Be warned that this file may not get updated when the operating system is updated, and thus give stale information. This is especially true with older files like /etc/issue.

Mac OS X

The version number is stored in the file /System/Library/CoreServices/SystemVersion.plist. Retrieve it with:

defaults read /System/Library/CoreServices/SystemVersion ProductVersion

BSD Distribution

I currently don't know another method beside uname to determine the FreeBSD or OpenBSD version on a file system.


/etc/apt/sources.list lists the sources used for updating the operating system.