1. 程式人生 > 其它 >我用爬蟲爬了很多小姐姐的桌布!

我用爬蟲爬了很多小姐姐的桌布!

1、當我們拿到一個 Linux 伺服器的時候,我怎麼知道他是 centos 系統,還是 ubantu 系統?
2、如果知道是 centos系統了,那我怎麼知道他是 centos7.6還是 centos8.0 還是其它的版本?

1. lsb_release 檢視系統

先使用 yum 安裝 redhat-lsb:

yum install -y redhat-lsb

# 安裝完成後,使用 -a 檢視
[root@yoyo ~] lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS  
Description:    CentOS Linux release 7.6.1810 (Core)
Release:    7.6.1810
Codename:   Core

2. redhat-release

如果已經知道是 centos 系統了,可以直接 cat 檢視版本號

[root@hecs ~]# cat /etc/redhat-release
CentOS Linux release 8.2.2004 (Core)

3. uname 檢視核心版本

檢視核心版本可以用 uname -a

[root@hecs ~]# uname -a
Linux hecs-226403 4.18.0-240.10.1.el8_3.x86_64 #1 SMP Mon Jan 18 17:05:51 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

也可以 cat /proc/version

[root@hecs ~]# cat /proc/version
Linux version 4.18.0-240.10.1.el8_3.x86_64 ([email protected]) (gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC)) #1 SMP Mon Jan 18 17:05:51 UTC 2021