Help us understand the problem. What is going on with this article?

Linux OSのバージョンを調べる方法

More than 1 year has passed since last update.

1. OSのディストリビューション名を調べる

cat /etc/os-release

[account /]$ cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"'

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

2. ディストリビューションのバージョンを調べる

今回はCENTOSだったので以下のコマンドを実行

cat /etc/redhat-release

[account /]$ cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)

※基本的には/etc/以下で[ディスロ名]-releaseファイルを探して中身を見れば解決

補足. Linuxカーネルのバージョンを調べる

以下のどちらでも良い

cat /proc/version

[account /]$ cat /proc/version
Linux version 4.4.0-121-generic (buildd@lcy01-amd64-004) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.9) ) #145-Ubuntu SMP Fri Apr 13 13:47:23 UTC 2018

 ⇨なぜにUbuntu文字が???

uname -a

[account /]$ uname -a
Linux localhost 4.4.0-121-generic #145-Ubuntu SMP Fri Apr 13 13:47:23 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away