5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

CentOS Linux のバージョンを調べるコマンドやファイル

Posted at

概要

  • CentOS Linux や Linux カーネルのバージョンをコマンドやファイルの中身を確認して調べる

/etc/centos-release

$ cat /etc/centos-release
CentOS Linux release 8.1.1911 (Core)

/etc/centos-release-upstream

$ cat /etc/centos-release-upstream
Derived from Red Hat Enterprise Linux 8.1 (Source)

/etc/os-release

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

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

/etc/system-release-cpe

$ cat /etc/system-release-cpe
cpe:/o:centos:centos:8

/etc/ 以下に release が付くファイル

このあたりのファイルにバージョン情報が載っている。シンボリックリンクされているのも多い。

$ ls -l /etc/ | grep release
-rw-r--r--   1 root root       38  3月 13 04:15 centos-release
-rw-r--r--   1 root root       51  3月 13 04:15 centos-release-upstream
lrwxrwxrwx   1 root root       21  3月 13 04:15 os-release -> ../usr/lib/os-release
lrwxrwxrwx   1 root root       14  3月 13 04:15 redhat-release -> centos-release
lrwxrwxrwx   1 root root       14  3月 13 04:15 system-release -> centos-release
-rw-r--r--.  1 root root       23  3月 13 04:15 system-release-cpe

uname: カーネル情報

$ uname -m
x86_64

$ uname -o
GNU/Linux

$ uname -r
4.18.0-147.5.1.el8_1.x86_64

$ uname -s
Linux

$ uname -v
#1 SMP Wed Feb 5 02:00:39 UTC 2020

$ uname -morsv
Linux 4.18.0-147.5.1.el8_1.x86_64 #1 SMP Wed Feb 5 02:00:39 UTC 2020 x86_64 GNU/Linux

$ uname -a
Linux foo.example.com 4.18.0-147.5.1.el8_1.x86_64 #1 SMP Wed Feb 5 02:00:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

lsb_release: LSB (Linux Standard Base) 情報

$ lsb_release -a
LSB Version:	:core-4.1-amd64:core-4.1-noarch
Distributor ID:	CentOS
Description:	CentOS Linux release 8.1.1911 (Core) 
Release:	8.1.1911
Codename:	Core

lsb_release コマンドは redhat-lsb-core パッケージに入っているので必要に応じて dnf install redhat-lsb-core などでインストールする。

hostnamectl

$ hostnamectl
   Static hostname: foo.example.com
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 11112222333344445555666677778888
           Boot ID: ffffeeeeddddccccbbbbaaaa00009999
    Virtualization: kvm
  Operating System: CentOS Linux 8 (Core)
       CPE OS Name: cpe:/o:centos:centos:8
            Kernel: Linux 4.18.0-147.5.1.el8_1.x86_64
      Architecture: x86-64

参考資料

5
5
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
5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?