zl程序教程

您现在的位置是:首页 >  其他

当前栏目

实例 : 如何在命令行中检查操作系统(OS)类型以及版本号

2023-02-26 12:26:45 时间
1. 查看内核版本(kernel version)信息:
[[email protected] genome]$ uname -a  Linux localhost.localdomain 4.18.0-240.22.1.el8_3.x86_64 #1 SMP Thu Apr 8 19:01:30 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
2. 查看发行版本信息(distribution information)

不同的系统发行版本需要使用不同的命令。

#centos 默认不支持 Linux Standard Base,需要安装 [[email protected] genome]$ lsb_release -a bash: lsb_release: command not found... Install package 'redhat-lsb-core' to provide command 'lsb_release'? [N/y] N [[email protected] genome]$ ll /etc/lsb-release ls: cannot access '/etc/lsb-release': No such file or directory #/etc/issue 文件包含信息或者系统识别信息,这些信息在登入提示之前会进行输出 #`r` : insert the release number of the OS #`m` : insert the architecture identifier of the machine [[email protected] genome]$ cat /etc/issue.net  S Kernel r on an m #对于 centos 或者 redhat linux发行版本,可以使用如下命令: [[email protected] genome]$ cat /etc/redhat-release  CentOS Linux release 8.3.2011 #同样,可以采用如下方式: [[email protected] genome]$ cat /etc/os-release  NAME="CentOS Linux" VERSION="8" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="8" PLATFORM_ID="platform:el8" PRETTY_NAME="CentOS Linux 8" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:8" HOME_URL="https://centos.org/" BUG_REPORT_URL="https://bugs.centos.org/" CENTOS_MANTISBT_PROJECT="CentOS-8" CENTOS_MANTISBT_PROJECT_VERSION="8" #或者:  [[email protected] genome]$ grep '^VERSION' /etc/os-release  VERSION="8" VERSION_ID="8" [[email protected] genome]$ egrep '^(VERSION|NAME)=' /etc/os-release  NAME="CentOS Linux" VERSION="8" #或者: [[email protected] genome]$ cat /proc/version  Linux version 4.18.0-240.22.1.el8_3.x86_64 ([email protected]) (gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC)) #1 SMP Thu Apr 8 19:01:30 UTC 2021 

reference :
[1] man7.org/linux/man-pages/man8/agetty.8.html?userCode=wrvvs1rm
[2] how to check os version in Linux command line.cyberciti.

(福利推荐:阿里云、腾讯云、华为云服务器最新限时优惠活动,云服务器1核2G仅88元/年、2核4G仅698元/3年,点击这里立即抢购>>>实例 : 如何在命令行中检查操作系统(OS)类型以及版本号


本站部分内容转载自网络,版权属于原作者所有,如有异议请联系QQ153890879修改或删除,谢谢!
转载请注明原文链接:实例 : 如何在命令行中检查操作系统(OS)类型以及版本号

你还在原价购买阿里云、腾讯云、华为云、天翼云产品?那就亏大啦!现在申请成为四大品牌云厂商VIP用户,可以3折优惠价购买云服务器等云产品,并且可享四大云服务商产品终身VIP优惠价,还等什么?赶紧点击下面对应链接免费申请VIP客户吧:

1、点击这里立即申请成为腾讯云VIP客户

2、点击这里立即注册成为天翼云VIP客户

3、点击这里立即申请成为华为云VIP客户

4、点击这里立享阿里云产品终身VIP优惠价

喜欢 (0)
[[email protected]]
分享 (0)