LoginSignup
22
14

More than 5 years have passed since last update.

Linux ディストリビューション・バージョンの確認方法

Last updated at Posted at 2017-07-16

サーバにインストールされているLinuxのディストリビューションを確認する方法とそのバージョンを確認する方法を記載します。

検証環境

docker
$ docker pull ubuntu // https://hub.docker.com/_/ubuntu/
$ docker pull centos // https://hub.docker.com/_/centos/
$ docker pull debian // https://hub.docker.com/_/debian/

解決方法について

Ubuntu
root@792772f62cdf:/# cat /etc/issue
Ubuntu 16.04.2 LTS

# or

root@9f3e980f7152:/# cat /etc/issue
Ubuntu 16.04.2 LTS \n \l

root@9f3e980f7152:/#
CentOS
root@9822a3c4d316 /# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
Debian
root@1c89b8c23fcd:/# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

# or 

root@7ef76ea4f938:/# cat /etc/issue
Debian GNU/Linux 9 \n \l

方法としては2つあります。

/etc/ディストリビューション名-release
/etc/issue 

のどちらかを見ればディストリビューション + そのバージョンが確認できます。

ちなみにLinux OSのバージョン確認方法は下記になります。

Linux
root@1c89b8c23fcd:/# cat /proc/version
Linux version 4.9.31-moby (root@11fbdc1f630f) (gcc version 6.2.1 20160822 (Alpine 6.2.1) ) #1 SMP Sat Jun 24 06:29:23 UTC 2017

or

Linux
root@7ef76ea4f938:/# uname -a
Linux 7ef76ea4f938 4.9.31-moby #1 SMP Sat Jun 24 06:29:23 UTC 2017 x86_64 GNU/Linux
22
14
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
22
14