[Linux] 快速查詢Linux發行版本與名稱(release & lsb_release)

引言

快速查詢各Linux發行版本與名稱,忘記時的好幫手…


查詢

快速指令lsb_release

lsb_release -a

一般適用於Debian系列,Centos可能沒有。查詢結果範例:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.1 LTS
Release:        16.04
Codename:       xenial

通用查詢/etc/*-release

ls -l /etc/*-release

不同的版本會有不同的*前綴,且最好查看內容別直接以前綴名稱當成版本。Centeos查詢結果範例:

-rw-r--r--. 1 root root 27 2017-03-28 18:25 /etc/centos-release
lrwxrwxrwx. 1 root root 14 2017-05-15 08:59 /etc/redhat-release -> centos-release
lrwxrwxrwx. 1 root root 14 2017-05-15 08:59 /etc/system-release -> centos-release

通用最速查詢

cat /etc/*-release

承上個查詢,一個一個或不知從何翻找的,來個快速一覽指令:

以上述範例,結果如下:

CentOS release 6.9 (Final)
CentOS release 6.9 (Final)
CentOS release 6.9 (Final)

Leave a Reply

Your email address will not be published. Required fields are marked *