系统相关
首页 > 系统相关> > 查看Linux版本信息的N种方法

查看Linux版本信息的N种方法

作者:互联网

1. cat /proc/version

键入以下命令得到的是linux内核版本

~$ cat /proc/version

例如我的老爷机装的Ubuntu,看到的版本是

Linux version 5.11.0-41-generic

2. lsb_release -a

LSB是Linux Standard Base的缩写, lsb_release命令 用来显示LSB和特定版本的相关信息。如果使用该命令时不带参数,则默认加上-v参数。

-v 显示版本信息。
-i 显示发行版的id。
-d 显示该发行版的描述信息。
-r 显示当前系统是发行版的具体版本号。
-c 发行版代号。
-a 显示上面的所有信息。
-h 显示帮助信息。

lsb_release -a这个命令适用于所有的linux,包括Redhat、SuSE、Debian等发行版。

3. cat /etc/issue

这个查看的是发行版的版本号,可以一眼看出是ubuntu海斯debian的等

~$ cat /etc/issue
Ubuntu 20.04.3 LTS \n \l

4. uname -a

uname,即Linux uname(英文全拼:unix name)命令用于显示系统信息。可显示电脑以及操作系统的相关信息。

uname -a可打印出所有信息,还有其他命令参数

       -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 (non-portable)

       -i, --hardware-platform
              print the hardware platform (non-portable)

       -o, --operating-system
              print the operating system

一个个试试看

~$ uname -a
Linux ubuntu 5.11.0-41-generic #45~20.04.1-Ubuntu SMP Wed Nov 10 10:20:10 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
~$ uname -s
Linux
~$ uname -n
ubuntu
~$ uname -r
5.11.0-41-generic
~$ uname -v
#45~20.04.1-Ubuntu SMP Wed Nov 10 10:20:10 UTC 2021
~$ uname -m
x86_64
~$ uname -p
x86_64
~$ uname -i
x86_64
~$ uname -o
GNU/Linux

5. dmesg | grep Linux

dmesg是用于编写内核消息的功能强大的命令,也可以用于获得内核版本信息。

Talk is cheap, try with it!

标签:kernel,x86,查看,--,uname,Linux,print,版本信息
来源: https://blog.csdn.net/lianyunyouyou/article/details/121727987