Linux下怎么查看系统版本号信息
在Linux系统中,我们可以使用一下命令来查看系统版本号信息:
1. cat /proc/version
2. uname -a
3. lsb_release -a
4. /etc/issue
5. /etc/*-release
6. hostnamectl
7. dmidecode -s bios-version
8. rpm -qf /etc/redhat-release
9. systemctl
第一种方法是使用cat命令来查看/proc/version文件,这个文件包含了当前系统的内核版本信息,如下所示:
[root@localhost ~]# cat /proc/version
Linux version 4.18.0-80.11.1.el8_0.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 8.3.1 20190507 (Red Hat 8.3.1-4) (GCC) ) #1 SMP Wed Sep 11 15:49:46 UTC 2019
第二种方法是使用uname命令,该命令可以查看当前系统的内核版本、操作系统版本、主机名称等信息,如下所示:
[root@localhost ~]# uname -a
Linux localhost.localdomain 4.18.0-80.11.1.el8_0.x86_64 #1 SMP Wed Sep 11 15:49:46 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
第三种方法是使用lsb_release命令,该命令可以查看当前系统的发行版本信息,如下所示:
[root@localhost ~]# lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 8.1.1911 (Core)
Release: 8.1.1911
Codename: Core
第四种方法是使用/etc/issue文件,该文件包含了当前系统的发行版本信息,如下所示:
[root@localhost ~]# cat /etc/issue
CentOS Linux release 8.1.1911 (Core)
Kernel \r on an \m (\l)
第五种方法是使用/etc/*-release文件,该文件包含了当前系统的发行版本信息,如下所示:
[root@localhost ~]# cat /etc/centos-release
CentOS Linux release 8.1.1911 (Core)
第六种方法是使用hostnamectl命令,该命令可以查看当前系统的主机名称、域名、内核版本等信息,如下所示:
[root@localhost ~]# hostnamectl
Static hostname: localhost.localdomain
Icon name: computer-vm
Chassis: vm
Machine ID: 9faa44cdb2b54f0a9e55f1a29c1a54f6
Boot ID: 4df2e63744d24a759e775b7cf6a61824
Virtualization: vmware
Operating System: CentOS Linux 8 (Core)
CPE OS Name: cpe:/o:centos:centos:8
Kernel: Linux 4.18.0-80.11.1.el8_0.x86_64
Architecture: x86-64
第七种方法是使用dmidecode命令,该命令可以查看当前系统的bios版本信息,如下所示:
[root@localhost ~]# dmidecode -s bios-version
2.6.5
第八种方法是使用rpm命令,该命令可以查看当前系统的发行版本信息,如下所示:
[root@localhost ~]# rpm -qf /etc/redhat-release
centos-release-8-1.1911.0.9.el8.x86_64
第九种方法是使用systemctl命令,该命令可以查看当前系统的启动时间、运行时间等信息,如下所示:
[root@localhost ~]# systemctl
UNIT LOAD ACTIVE SUB JOB DESCRIPTION
proc-sys-fs-binfmt_misc.automount loaded active waiting Arbitrary Executable File Formats File System Automount Point
sys-devices-platform-serial8250-tty-ttyS0.device loaded active plugged /dev/ttyS0
sys-devices-platform-serial8250-tty-ttyS1.device loaded active plugged /dev/ttyS1
-.mount loaded active mounted /
systemd-ask-password-console.path loaded active waiting Dispatch Password Requests to Console Directory Watch
systemd-ask-password-wall.path loaded active waiting Dispatch Password Requests to Wall Directory Watch
systemd-binfmt.service loaded active running Arbitrary Executable File Formats File System Checker
systemd-journald.service loaded active running Journal Service
systemd-logind.service loaded active running Login Service
systemd-remount-fs.service loaded active exited Remount Root and Kernel File Systems
systemd-sysctl.service loaded active exited Apply Kernel Variables
systemd-tmpfiles-setup.service loaded active exited Create Volatile Files and Directories
systemd-udev-trigger.service loaded active exited udev Coldplug all Devices
systemd-udevd.service loaded active running udev Kernel Device Manager
LOAD = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB = The low-level unit activation state, values depend on unit type.
JOB = Pending job for the unit.
JOB = Unit has no pending jobs.
LOAD = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB = The low-level unit activation state, values depend on unit type.
JOB = Pending job for the unit.
JOB = Unit has no pending jobs.
5 loaded units listed.
Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
root@localhost ~]#
相关文章