在centos6我們可以使用

# cat /etc/issue 來查看作業系統版本

[root@localhost ~]# cat /etc/issue
CentOS release 6.8 (Final)
Kernel \r on an \m
 

但這個方法在centos7,就得不到資訊了

[root@localhost ~]# cat /etc/issue
\S
Kernel \r on an \m

你在centos7中要使用 # cat /etc/redhat-release

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

這樣就得到我們想要的系統版本資訊了

arrow
arrow

    痞客興 發表在 痞客邦 留言(0) 人氣()