ubuntu查看系统版本信息的方法汇总(代码片段)

白-胖-子 白-胖-子     2022-12-06     394

关键词:

cat /proc/version

推荐使用此方法获取Linux版本信息

  • 查看显示内存中kernel相关的版本、编译等信息
  • Ubuntu和CentOS通用,可以显示内核版本同时显示发行版本
sun@u20a:/root$ cat /proc/version
Linux version 5.4.0-77-generic (buildd@lgw01-amd64-028) (gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)) #86-Ubuntu SMP Thu Jun 17 02:35:03 UTC 2021
[root@C8-186 ~]# cat /proc/version
Linux version 4.18.0-147.el8.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 8.3.1 20190507 (Red Hat 8.3.1-4) (GCC)) #1 SMP Wed Dec 4 21:51:45 UTC 2019

uname -a

  • uname命令用来查看系统信息,Ubuntu和CentOS通用
  • 只有内核版本,没有发行版本
sun@u20a:/root$ uname -a
Linux u20a 5.4.0-77-generic #86-Ubuntu SMP Thu Jun 17 02:35:03 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
[root@C8-186 ~]# uname -a
Linux C8-186 4.18.0-147.el8.x86_64 #1 SMP Wed Dec 4 21:51:45 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
  • uname详细信息
sun@u20a:/root$ whatis uname
uname (1)            - print system information
sun@u20a:/root$ uname --help
Usage: 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 (non-portable)
  -i, --hardware-platform  print the hardware platform (non-portable)
  -o, --operating-system   print the operating system
      --help     display this help and exit
      --version  output version information and exit

cat /etc/issue

不推荐,但是可以快速取到Ubuntu发行版本号

  • /etc/issue文件是Linux系统开机启动时在命令行界面弹出的欢迎语句文件
  • Ubuntu中记录了发行版本名,但CentOS没有
sun@u20a:/root$ cat /etc/issue
Ubuntu 20.04.2 LTS \\n \\l
[root@C8-186 ~]# cat /etc/issue
\\S
Kernel \\r on an \\m

lsb_release -a

  • lsb_release:prints certain LSB (Linux Standard Base) and Distribution information.
  • 专门用来查看当前系统的发行版信息的命令
  • Ubuntu默认已安装,但最小化安装CentOS没有安装
sun@u20a:/root$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.2 LTS
Release:	20.04
Codename:	focal
  • CentOS需要额外安装软件包
[root@C8-186 ~]# lsb_release -a
-bash: lsb_release: command not found
[root@C8-186 ~]# yum -y install lsb_release
BaseOS                                                                                                                                      31 kB/s | 3.9 kB     00:00    
AppStream                                                                                                                                   37 kB/s | 4.3 kB     00:00    
EPEL                                                                                                                                        32 kB/s | 4.7 kB     00:00    
extras                                                                                                                                      12 kB/s | 1.5 kB     00:00    
centosplus                                                                                                                                  12 kB/s | 1.5 kB     00:00    
No match for argument: lsb_release
Error: Unable to find a match: lsb_release
[root@C8-186 ~]# yum provides lsb_release
Last metadata expiration check: 0:00:16 ago on Tue 13 Jul 2021 07:05:20 PM CST.
redhat-lsb-core-4.1-47.el8.i686 : LSB Core module support
Repo        : AppStream
Matched from:
Filename    : /usr/bin/lsb_release

redhat-lsb-core-4.1-47.el8.x86_64 : LSB Core module support
Repo        : AppStream
Matched from:
Filename    : /usr/bin/lsb_release

[root@C8-186 ~]# yum -y install redhat-lsb-core-4.1-47.el8.x86_64
#……省略的安装信息
Installed:
  redhat-lsb-core-4.1-47.el8.x86_64      at-3.1.20-11.el8.x86_64            avahi-libs-0.7-20.el8.x86_64                       cups-libs-1:2.2.6-38.el8.x86_64          
  ed-1.14.2-4.el8.x86_64                 mailx-12.5-29.el8.x86_64           ncurses-compat-libs-6.1-7.20180224.el8.x86_64      patch-2.7.6-11.el8.x86_64                
  psmisc-23.1-5.el8.x86_64               spax-1.5.3-13.el8.x86_64           time-1.9-3.el8.x86_64                              util-linux-user-2.32.1-27.el8.x86_64     
  cups-client-1:2.2.6-38.el8.x86_64      liblockfile-1.14-1.el8.x86_64      redhat-lsb-submod-security-4.1-47.el8.x86_64       esmtp-1.2-15.el8.x86_64                  
  libesmtp-1.0.6-18.el8.x86_64          

Complete!
[root@C8-186 ~]# lsb_release 
LSB Version:	:core-4.1-amd64:core-4.1-noarch
[root@C8-186 ~]# 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

查看linux版本信息的n种方法(代码片段)

...得到的是linux内核版本~$cat/proc/version例如我的老爷机装的Ubuntu,看到的版本是Linuxversion5.11.0-41-generic2.lsb_release-aLSB是LinuxStandardBase的缩写,lsb_release命令用来显示LSB和特定版本的相关信息。如果使用该命令时不带参数,... 查看详情

linux系统知识汇总(代码片段)

1系统相关1.1静态IP地址配置Ubuntu配置和修改IP地址1.2Linux内核升级和降级内核升级Linux升级内核的正确姿势内核降级Ubuntu16.04内核降级1.3清理缓存cacheubuntu手动释放缓存(清理内存cache)2JupyterLab2.1远程服务器访问Ubuntu服务器JupyterNoteboo... 查看详情

如何查看当前ubuntu系统的版本

工具原料:电脑+ubuntu查看当前Ubuntu系统的版本方法如下:一、more/etc/issue命令查看1、OracleLinux2、CentosLinux代码如下:3、RedHatLinux代码如下:4、 (Tikanga)Kernelronanm二、lsb_release-a命令查看1、OracleLinux代码如下:  [root@DB-Server~]#lsb_release... 查看详情

linux(ubuntu/centos)下查看glibc版本(代码片段)

title:Linux(Ubuntu/CentOS)下查看GLIBC版本date:2020-10-0623:35author:gatiemetags:linuxcategories:-linuxthumbnail:blogexcerpt:之前在工作中,经常有同事问我怎么知道当前系统中GLIBC的版本号是多少.今天安装软件的时候,想到了这个问题,于是记录下,与大家... 查看详情

linux常用基本命令汇总(代码片段)

...t12.文件查看moreLinux常见的发行版本有:Centos、Redhat、ubuntu等,本文的选用Linux发行版本ubuntu。Linux终端命令格式: 查看详情

如何查看ubuntu系统的版本

参考技术A方法/步骤进入Ubuntu系统,点击左侧图标栏中的黑框,打开终端。左侧没有终端图标的情况,可以搜索按钮(图中左侧第一个),输入termial,打开终端。桌面终端也没有搜索图标的情况,可以使用快捷键打开终端快捷键(Ctr... 查看详情

查看系统信息(代码片段)

#系统名称uname#内核版本uname-r#系统版本信息cat/etc/centos-release#查看系统版本lsb_release-a#relasecat/ect/xxx-release 查看详情

操作系统权限提升(十八)之linux提权-内核提权(代码片段)

...作查看Linux操作系统的内核版本和相关信息cat/etc/issue查看ubuntu或者centos的版本cat/etc/*-release查看centos版本uname-a查看系统全部信息uname-r查看内核版本EXP该怎么着呢,可以用Kali去寻找,kali中自带searchsploit命令可以查找EXP,输... 查看详情

linux查看系统信息命令(代码片段)

linux查看系统信息命令是linux初学者必备的基础知识,下面给除了各linux发行版比较常用的系统信息查询的命令#uname-a#查看内核/操作系统/CPU信息#head-n1/etc/issue#查看操作系统版本#cat/proc/cpuinfo#查看CPU信息#hostname#查看计算机名#lspci-tv#... 查看详情

查看数据库占用磁盘空间的方法(代码片段)

...2,4.3.4.9文档用途本文用于指导在日常生产运维工作中如何查看数据库占有磁盘空间大小的方法。详细信息一、通过系统函数查找通过系统函数查询数据库大小得到的结果仅为数据库、模式、表等各类逻辑数据对象占用大小,... 查看详情

查看数据库占用磁盘空间的方法(代码片段)

...2,4.3.4.9文档用途本文用于指导在日常生产运维工作中如何查看数据库占有磁盘空间大小的方法。详细信息一、通过系统函数查找通过系统函数查询数据库大小得到的结果仅为数据库、模式、表等各类逻辑数据对象占用大小,... 查看详情

ubuntu查看opencv的版本(代码片段)

ctrl+alt+t呼出终端,输入下面命令,查看版本:pkg-config--modversionopencv没有安装OpenCV的同学:Ubuntu20.04安装OpenCV3.4.5(两种方法&&图文详解) 查看详情

windows命令行大汇总(代码片段)

...的命令工具 操作系统版本C:\\Users\\pacer>winver#打开界面查看操作系统版本windows系统自带木马工具PSC:\\Users\\pacer>iexpresswindows体系结构C:\\Users\\pacer>wmimgmt.msc#打开windows管理体系结构windows脚本C:\\Users\\pacer>wscript#windows脚本宿... 查看详情

docker常用指令汇总(代码片段)

...f0c;命令的格式如下:docker[image]pullrepository[:<tag>]#Ubuntu镜像的拉取#dockerimagepullubuntu:latest#dockerpullubuntu:20.04#dockerpullubuntu#加载本地的镜像文件dockerload-iubuntu_18.04.tar#导出镜像dockersave-oubuntu_18.04.tarubuntu:18.04  一般来说,... 查看详情

centos7安装软件包的方法(代码片段)

...派系:红帽子派系(Redhat、Centos、OracleLinux)、Debian派(Ubuntu、Kali),SUSE派系(SuSe、OpenSUSE)等。红帽子派是Linux服务器操作系统的主流,本文重点介绍红帽子派系中rpm和yum安装软件包的方法。一、rpm安装RPM是RedHatPackageManager的... 查看详情

ubuntu安装cuda(代码片段)

目录1、查看系统推荐的cuda版本2、官网下载cuda软件包3、安装4、环境配置5、验证cuda是否正常1、查看系统推荐的cuda版本查看前应先安装显卡驱动,可以查看NVIDIA显卡驱动安装nvidia-smi这里显示的是cuda11.4版本2、官网下载cuda软... 查看详情

centos查看系统内核和版本(代码片段)

1、uname命令用于查看系统内核与系统版本等信息,格式为“uname[-a]”。[[email protected]~]#uname-aLinuxbigdata-senior01.home.com3.10.0-693.el7.x86_64#1SMPTueAug2221:09:27UTC2017x86_64x86_64x86_64GNU/Linux用法:uname[选项]...输出一组系统信息。如果不跟随... 查看详情

ubuntu下查看显卡驱动是否成功安装(代码片段)

ubuntu下查看显卡驱动是否成功安装的方法ubuntu下查看显卡驱动是否成功安装的方法方法一:通过查看`设置->详细信息->关于`查看方法二:通过终端查看方法三:通过终端`nvidia-smi`查看ubuntu下查看显卡... 查看详情