LinuxのOS/ディストリビューションを確認するコマンド

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

使用しているディストリビューションを調べるコマンドというのは、実は存在しません。
ただし、/etc/以下に、ディストリビューションのバージョンを記述したファイルが必ずありますので、catで参照します。

cat /etc/issue で調べる

まずはこちらのファイルを見てみます。

RedHat、CentOSの場合

$ cat /etc/issue
CentOS release 5.7 (Final)
Kernel \r on an \m

Fedoraの場合

$ cat /etc/issue
Fedora release 8 (Werewolf)
Kernel \r on an \m

Debianの場合

$ cat /etc/issue
Debian GNU/Linux squeeze/sid \n \l

cat /etc/ディストリビューション-release で調べる

もしissueがなかったり、書かれていなかったりした場合は、releaseファイルで調べてみましょう。

RedHat、CentOSの場合

$ cat /etc/redhat-release
CentOS release 5.7 (Final)

Fedoraの場合

$ cat /etc/fedora-release
Fedora release 8 (Werewolf)

Debianの場合

$ cat /etc/debian_version
4.0

(まれに /etc/debian_release の場合もあります。)

Turbolinuxの場合

$ cat /etc/turbolinux-release
Turbolinux Server 6.5 (Jupiter)

SuSE Linuxの場合

$ cat /etc/SuSE-release
SUSE Linux Enterprise Server 10 (x86_64)
VERSION=10
PATCHLEVEL=1

Ubuntuの場合

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=8.04
DISTRIB_CODENAME=hardy
DISTRIB_DESCRIPTION=”Ubuntu 8.04.1″

Ubuntuの場合は、ubuntu-releaseではないので注意が必要です。

その他の場合

その他の各種ディストリビューションでも、「/etc/ディストリビューション名-release」を参照するとわかります。

  • Gentoo Linux: /etc/gentoo-release
  • Mandrake: /etc/mandrake-release
  • Mandriva Linux: /etc/mandriva-release
  • Novell Linux Desktop: /etc/nld-release
  • Solaris SPARC: /etc/release
  • Sun JDS: /etc/sun-release

2 thoughts on “LinuxのOS/ディストリビューションを確認するコマンド

  1. AlexisBrums

    See the difference.
    Another success aphorism comes from Chris Grosser.
    What am I referring to.
    Napoleon Bonaparte could relate.
    That’s not what you expected, was it.
    Why is this stuff important.
    Not only that, but you can use aphorisms in your writing to summarize your central theme.
    The term aphorism originates from late Latin aphorismus and Greek aphorismos.
    Early to bed and early to rise makes a man healthy, wealthy, and wise.
    The meaning.
    The part in Star Wars where Yoda says, There is do, or do not.
    Napoleon Bonaparte could relate.
    Interestingly enough, this saying was initially intended as a compliment.
    search bar with “what use aphorism.” written
    Give it a try!
    Aphorisms are so common that we hardly think twice about them.

    返信

匿名 へ返信する コメントをキャンセル

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です