实例 : 如何在命令行中检查操作系统(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年,点击这里立即抢购>>>)
你还在原价购买阿里云、腾讯云、华为云、天翼云产品?那就亏大啦!现在申请成为四大品牌云厂商VIP用户,可以3折优惠价购买云服务器等云产品,并且可享四大云服务商产品终身VIP优惠价,还等什么?赶紧点击下面对应链接免费申请VIP客户吧:
相关文章
- Jgit的使用笔记
- 利用Github Action实现Tornadofx/JavaFx打包
- 叹息!GitHub Trending 即将成为历史!
- 微软软了?开源社区讨论炸锅,GitHub CEO 亲自来答
- GitHub Trending 列表频现重复项,前后端都没去重?
- Photoshop Elements 2021版本软件安装教程(mac+windows全版本都有)
- (ps全版本)Photoshop 2020的安装与破解教程(mac+windows全版本都有)
- (ps全版本)Photoshop cc2018的安装与破解教程(mac+windows全版本,包括2023
- 环境搭建:Oracle GoldenGate 大数据迁移到 Redshift/Flat file/Flume/Kafka测试流程
- 每个开发人员都要掌握的:最小 Linux 基础课
- 来撸羊毛了!Windows 环境下 Hexo 博客搭建,并部署到 GitHub Pages
- 超实用!手把手入门 MongoDB:这些坑点请一定远离
- 【GitHub日报】22-10-09 zustand、neovim、webtorrent、express 等4款App今日上新
- 【GitHub日报】22-10-10 brew、minio、vite、seaweedfs、dbeaver 等8款App今日上新
- 【GitHub日报】22-10-11 cobra、grafana、vue、ToolJet、redwood 等13款App今日上新
- Photoshop 2018 下载及安装教程(mac+windows全版本都有,包括最新的2023)
- Photoshop 2017 下载及安装教程(mac+windows全版本都有,包括最新的2023)
- Photoshop 2020 下载及安装教程(mac+windows全版本都有,包括最新的2023)
- Photoshop 2023 资源免费下载(mac+windows全版本都有,包括最新的2023)
- 最新版本Photoshop CC2018软件安装教程(mac+windows全版本都有,包括2023