网站首页 > linux / 正文
一、通过发行版的特定文件查看
发行版的说明文件一般位于 /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查看用户信息
- 上一篇:Linux 查看进程的动态信息
- 下一篇:Linux查看目录中的文件(ls命令)
猜你喜欢
- 2024-11-26 Linux 查看进程的动态信息
- 2024-11-26 Linux查看CPU硬件信息
- 2024-11-26 运维,你还不会查看Linux系统cpu信息?
- 2024-11-26 Linux查看日志的命令记不住,咋办?一文全面解析清楚,建议收藏
- 2024-11-26 02、Linux查看文件命令
- 2024-11-26 NeoFetch - Linux 使用命令行查看系统信息
- 2024-11-26 怎么查看Linux系统版本信息
- 2024-11-26 linux 查看磁盘信息的常用命令
- 2024-11-26 如何在 Linux 下优雅的查看系统 CPU 信息
- 2024-11-26 Linux 查看版本信息