37
22

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 5 years have passed since last update.

OSバージョン確認コマンドリファレンス(Windows/Mac/Linux)ー2018.04版

Last updated at Posted at 2018-04-08

※随時更新します

はじめに

ブログ記事を書くとき、前提環境の情報としてOSのバージョンを書くことがあります。

状況に応じてWindows/Mac/Linuxと色々なOSに触ることがあるので、その自分用の備忘リファレンスが欲しかったのでまとめました。

以下2つをOSごとにまとめていきます。

  1. OSバージョン確認コマンド
  2. コマンド実行結果例

Windows

※コマンドプロンプトで実行
> ver
Microsoft Windows [Version 10.0.15063]

Mac OS X

$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.13.3
BuildVersion:   17D102

Linux

Debian系

Debian

$ cat /etc/debian_version 
6.0.7

Ubuntu

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04 LTS"

Raspbian (Raspberry Pi)

$ cat /etc/debian_version
7.8

または

$ cat /etc/issue
Raspbian GNU/Linux 7 \n \l

RedHat系

CentOS / RedHat

$ cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)

Fedora

$ cat /etc/fedora-release 
Fedora release 26 (Twenty Six)

SUSE Linux

$ cat /etc/os-release
NAME="openSUSE Leap"
VERSION="42.3"
ID=opensuse
ID_LIKE="suse"
VERSION_ID="42.3"
PRETTY_NAME="openSUSE Leap 42.3"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:leap:42.3"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/"

Alpine Linux

$ cat /etc/alpine-release
3.7.0

Amazon Linux

$ cat /etc/system-release
Amazon Linux AMI release 2016.09

最後に

ここに書いていないOSのバージョン確認コマンドあればコメントいただけますと幸いです。

参考URL

37
22
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
37
22

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?