View Linux system version
CentOS system
# centos7 view command [root@localhost ~]# cat /etc/os-release # centos6/7 general commands [root@localhost ~]# cat /etc/redhat-release [root@localhost ~]# cat /etc/redhat-release | sed -r 's/.* ([0-9]+)\..*/\1/' # centos6/7 general commands [root@localhost ~]# cat /etc/centos-release [root@localhost ~]# cat /etc/centos-release | sed -r 's/.* ([0-9]+)\..*/\1/' # centos6/7 general commands [root@localhost ~]# rpm -q centos-release [root@localhost ~]# rpm -q centos-release | cut -d- -f3 # The file /etc/redhat-release exists in radhat or centos. [Command cat /etc/redhat-release]
Ubuntu system
ubuntu@VM-0-9-ubuntu:~$ lsb_release -a ubuntu@VM-0-9-ubuntu:~$ cat /etc/os-release ubuntu@VM-0-9-ubuntu:~$ cat /etc/issue ubuntu@VM-0-9-ubuntu:~$ less /etc/issue # ubuntu exists: /etc/lsb-release this file [command cat /etc/lsb-release]
View Linux kernel version
[root@localhost ~]# cat /proc/version [root@localhost ~]# uname -a