kali2020.3 vm版本内核是多少_如何获取Linux或者macOS系统版本相关信息

uname 命令的输出就可以获取这些信息,但这些信息都是什么,它告诉了你什么?

在这篇文章中,我们将仔细看看 uname 命令的输出,以及一些其他命令和文件提供的版本描述。

使用 uname

每当你在Linux系统终端窗口中发出uname -a命令时,就会显示很多信息。 事实上,每一块显示的信息都会告诉你一些关于系统的不同信息。

uname -a命令=uname -snmrvpioLinux parallels 3.10.0-862.11.6.el7.x86_64 #1 SMP Tue Aug 14 21:49:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux通过help命令可以看到详细的说明uname --helpUsage: uname [OPTION]...Print certain system information.  With no OPTION, same as -s.  -a, --all                print all information, in the following order,                             except omit -p and -i if unknown:  -s, --kernel-name        print the kernel name  -n, --nodename           print the network node hostname  -r, --kernel-release     print the kernel release  -v, --kernel-version     print the kernel version  -m, --machine            print the machine hardware name  -p, --processor          print the processor type or "unknown"  -i, --hardware-platform  print the hardware platform or "unknown"  -o, --operating-system   print the operating system      --help     display this help and exit      --version  output version information and exit

现在我们通过一个shell来展示下各个的对应关系:

# for option in s n m r v p i o; do echo -n "$option: "; uname -$option; dones: Linux n: parallelsm: x86_64r: 3.10.0-862.11.6.el7.x86_64v: #1 SMP Tue Aug 14 21:49:04 UTC 2018p: x86_64i: x86_64o: GNU/Linux需要注意r: 3.10.0-862.11.6.el7.x86_64这个内核版本3是内核版本10表示主要修订0表示小修862代表最新的补丁#1表示这个版本已经编译了1次(v: #1 SMP Tue Aug 14 21:49:04 UTC 2018)

如果你需要知道你正在运行的发行版是什么版本,uname的输出不会给你太多帮助。内核版本毕竟和发行版不一样。为了获得这些信息,你可以在 Ubuntu 和其他基于 Debian 的系统上使用 lsb_release -r 命令,并显示 Red Hat 的 /etc/redhat-release 文件的内容。

举例在各个系统下命令

Red Hat or CentOS systems# uname -aLinux parallels 3.10.0-862.11.6.el7.x86_64 #1 SMP Tue Aug 14 21:49:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux# lsb_release -aLSB Version::core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarchDistributor ID:CentOSDescription:CentOS Linux release 7.5.1804 (Core)Release:7.5.1804Codename:Core# lsb_release -rRelease:7.5.1804# cat /etc/redhat-releaseCentOS Linux release 7.5.1804 (Core)For Debian systems:$ lsb_release -rRelease: 20.04For Red Hat and related systems:$ cat /etc/redhat-releaseRed Hat Enterprise Linux release 8.1 Beta (Ootpa)Using /proc/versionThe /proc/version file can also provide information on your Linux release. The information provided in this file has a lot in common with the uname -a output. Here are some examples.On Ubuntu:$ cat /proc/versionLinux version 5.4.0-37-generic (buildd@lcy01-amd64-001) (gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2)) #41-Ubuntu SMP Wed Jun 3 18:57:02 UTC 2020On RedHat:$ cat /proc/versionLinux version 4.18.0-107.el8.x86_64 (mockbuild@x86-vm-09.build.eng.bos.redhat.com) (gcc version 8.3.1 20190507 (Red Hat 8.3.1-4) (GCC)) #1 SMP Fri Jun 14 13:46:34 UTC 2019

下面是macOS系统的

macOS系统 Show operating system name and more➜  ~ uname -aDarwin Mac 19.6.0 Darwin Kernel Version 19.6.0: Thu Jun 18 20:49:00 PDT 2020; root:xnu-6153.141.1~1/RELEASE_X86_64 x86_64 i386 MacBookPro15,1 DarwinShow Mac OS X operating system version➜  ~ sw_versProductName:Mac OS XProductVersion:10.15.6BuildVersion:19G2021Show Apple hardware and software configuration➜  ~ system_profiler 获取的信息量比较大,需要自己提取system_profiler SPSoftwareDataTypeSoftware:    System Software Overview:      System Version: macOS 10.15.6 (19G2021)      Kernel Version: Darwin 19.6.0      Boot Volume: Macintosh HD      Boot Mode: Normal      Computer Name: Mac      User Name: 隐藏哈      Secure Virtual Memory: Enabled      System Integrity Protection: Disabled      Time since boot: 3 days 23:53
150c6c3bf9ce42a7b5e222800d308a9b
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值