查看系统信息,区分Centos和Ubuntu

查看系统信息,区分Centos和Ubuntu

# cat /etc/issue
\S
Kernel \r on an \m

centos

$ cat /etc/issue
Ubuntu 16.04.4 LTS \n \l

ubuntu

radhat或centos存在: /etc/redhat-release 这个文件【 命令 cat /etc/redhat-release 】

# cat /etc/redhat-release 
CentOS Linux release 7.4.1708 (Core) 

ubuntu存在 : /etc/lsb-release 这个文件 【命令 cat etc/lsb-release 】

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

再一个简单的就是,看看安装指令,有yum的就是Centos,有apt-get的就是Ubuntu。

还有就是uname -v 或者 uname -a 这个有可能区分不了。

猜你喜欢

转载自www.cnblogs.com/jiqing9006/p/9268099.html