MySQL, Oracle, Linux, 软件架构及大数据技术知识分享平台

网站首页 > linux / 正文

Linux 如何查看当前系统版本的详细信息?

2024-11-26 16:44 huorong linux 7 ℃ 0 评论

一、通过发行版的特定文件查看

发行版的说明文件一般位于 /etc 目录下面文件名包含:release 字样的文件

查看CentOS,Red Hat的版本

cat /etc/centos-release
# Example: CentOS Linux release 7.9.2009 (Core)

cat /etc/redhat-release
# Example: Red Hat Enterprise Linux Server release 8.5 (Ootpa)

查看Debian和Ubuntu的版本

cat /etc/debian_version

cat /etc/os-release
# Example:
# PRETTY_NAME="Ubuntu 22.04.3 LTS"
# VERSION="22.04.3 LTS (Jammy Jellyfish)"

cat /etc/issue
# Example: Ubuntu 22.04.3 LTS \n \l

查看Fedora的版本

cat /etc/fedora-release
# Example: Fedora release 38 (Thirty Eight)

二、使用lsb_release命令查看

lsb_release 命令以标准的方式提供详细的发行版信息

如果没有安装先安装

sudo apt install lsb-release  # Debian/Ubuntu
sudo yum install redhat-lsb   # CentOS/RHEL

用法:

lsb_release -a

# Output:
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.3 LTS
Release:        22.04
Codename:       jammy

三、使用hostnamectl命令查看

hostnamectl 命令是包含在 systemd 工具套件的里面的

用法:

hostnamectl

# Output:
   Static hostname: myserver
         Icon name: computer-vm
           Chassis: vm
        Machine ID: xxxxxxxxxxxxx
           Boot ID: xxxxxxxxxxxxx
  Operating System: Ubuntu 22.04.3 LTS
            Kernel: Linux 5.15.0-79-generic
      Architecture: x86_64

四、使用uname命令查看

uname 一般用来查看 Linux 内核版本

用法:

uname -a

# Output:
Linux myserver 5.15.0-79-generic #86-Ubuntu SMP Wed Sep 27 15:51:31 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

五、使用neofetch或screenfetch命令查看

安装:

sudo apt install neofetch   # Debian/Ubuntu
sudo yum install neofetch   # CentOS/RHEL

sudo apt install screenfetch   # Debian/Ubuntu
sudo yum install screenfetch   # CentOS/RHEL

用法:

neofetch

screenfetch

六、使用/etc/os-release文件查看

/etc/os-release 文件在现代化 Linux 系统中基本都存在,所以是一种标准的获取系统信息的方式
用法:

cat /etc/os-release

七、使用sw_vers命令可查看Mac版本信息

sw_vers

Tags:linux查看用户信息

控制面板
您好,欢迎到访网站!
  查看权限
网站分类
最新留言