查看Linux版本信息命令
2017-08-08 13:37
417 查看
通常使用命令uname在Linux下面察看版本信息
-a或--all:显示全部的信息;
-m或--machine:显示电脑类型;
-n或-nodename:显示在网络上的主机名称;
-r或--release:显示操作系统的发行编号;
-s或--sysname:显示操作系统名称;
-v:显示操作系统的版本;
-p或--processor:输出处理器类型或"unknown";
-i或--hardware-platform:输出硬件平台或"unknown";
-o或--operating-system:输出操作系统名称;
--help:显示帮助;
--version:显示版本信息。
RedHat:
uname -a
Linux localhost.localdomain 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:39 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
Centos:
uname -a
Linux localhost.localdomain 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Debian:
uname -a
Linux debian 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1+deb8u1 (2016-09-03) x86_64 GNU/Linux
-a选项表示察看所有的信息,但是从输出信息可以看出来,uname看到的版本信息,只是内核版本的信息,而不是发行版的版本信息
那如果我们想察看发行版的信息的话
RedHat:
cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.5 (Tikanga)
Centos:
cat /etc/centos-release
CentOS Linux release 7.2.1511 (Core)
Debian:
cat /etc/debian_version
8.6
那有没有一个更加通用的方法呢?那就是/etc/issue文件,issue文件是登录前的信息和标识文件,里面存放了发行版的版本信息
RedHat:
cat /etc/issue
Red Hat Enterprise Linux Server release 5.5 (Tikanga)
Kernel \r on an \m
Centos:(我在Centos7.2中执行该命令后却没有出现想要的结果)
cat /etc/issue
\S
Kernel \r on an \m
Debian:(结果也不是很理想)
cat /etc/issue
Debian GNU/Linux 8 \n \l
Ubuntu:
cat /etc/issue
Ubuntu 10.04.1 LTS /n /l
还有一种方式:LSB是Linux Standard Base的缩写,lsb_release命令用来显示LSB和特定版本的相关信息。如果使用该命令时不带参数,则默认加上-v参数(在我装的Debian里测试时-v这个参数并不能使用,其他参数则正常)。
-v, --version 显示版本信息
-i, --id 显示发行版的ID
-d, --description 显示该发行版的描述信息
-r, --release 显示当前系统是发行版的具体版本号
-c, --codename 发行版代号
-a, --all 显示上面的所有信息
RedHat:
lsb_release -a
LSB Version: :core-3.1-amd64:core-3.1-ia32:core-3.1-noarch:graphics-3.1-amd64:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: RedHatEnterpriseServer
Description: Red Hat Enterprise Linux Server release 5.5 (Tikanga)
Release: 5.5
Codename: Tikanga
Debian:
lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 8.6 (jessie)
Release: 8.6
Codename: jessie
CentOS7在默认安装时,没有安装lsb_release。得安装后才可正常使用:
yum -y install redhat-lsb
-a或--all:显示全部的信息;
-m或--machine:显示电脑类型;
-n或-nodename:显示在网络上的主机名称;
-r或--release:显示操作系统的发行编号;
-s或--sysname:显示操作系统名称;
-v:显示操作系统的版本;
-p或--processor:输出处理器类型或"unknown";
-i或--hardware-platform:输出硬件平台或"unknown";
-o或--operating-system:输出操作系统名称;
--help:显示帮助;
--version:显示版本信息。
RedHat:
uname -a
Linux localhost.localdomain 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:39 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
Centos:
uname -a
Linux localhost.localdomain 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Debian:
uname -a
Linux debian 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1+deb8u1 (2016-09-03) x86_64 GNU/Linux
-a选项表示察看所有的信息,但是从输出信息可以看出来,uname看到的版本信息,只是内核版本的信息,而不是发行版的版本信息
那如果我们想察看发行版的信息的话
RedHat:
cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.5 (Tikanga)
Centos:
cat /etc/centos-release
CentOS Linux release 7.2.1511 (Core)
Debian:
cat /etc/debian_version
8.6
那有没有一个更加通用的方法呢?那就是/etc/issue文件,issue文件是登录前的信息和标识文件,里面存放了发行版的版本信息
RedHat:
cat /etc/issue
Red Hat Enterprise Linux Server release 5.5 (Tikanga)
Kernel \r on an \m
Centos:(我在Centos7.2中执行该命令后却没有出现想要的结果)
cat /etc/issue
\S
Kernel \r on an \m
Debian:(结果也不是很理想)
cat /etc/issue
Debian GNU/Linux 8 \n \l
Ubuntu:
cat /etc/issue
Ubuntu 10.04.1 LTS /n /l
还有一种方式:LSB是Linux Standard Base的缩写,lsb_release命令用来显示LSB和特定版本的相关信息。如果使用该命令时不带参数,则默认加上-v参数(在我装的Debian里测试时-v这个参数并不能使用,其他参数则正常)。
-v, --version 显示版本信息
-i, --id 显示发行版的ID
-d, --description 显示该发行版的描述信息
-r, --release 显示当前系统是发行版的具体版本号
-c, --codename 发行版代号
-a, --all 显示上面的所有信息
RedHat:
lsb_release -a
LSB Version: :core-3.1-amd64:core-3.1-ia32:core-3.1-noarch:graphics-3.1-amd64:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: RedHatEnterpriseServer
Description: Red Hat Enterprise Linux Server release 5.5 (Tikanga)
Release: 5.5
Codename: Tikanga
Debian:
lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 8.6 (jessie)
Release: 8.6
Codename: jessie
CentOS7在默认安装时,没有安装lsb_release。得安装后才可正常使用:
yum -y install redhat-lsb
相关文章推荐
- 查看 Linux 版本信息的几个命令
- Linux命令:查看版本信息+删除
- [Linux学习笔记] Linux常用命令 - 用户版本信息查看
- 命令查看linux系统发行版本信息
- Linux常用命令一 查看系统负载 版本信息 工作目录
- linux之查看版本信息命令
- Linux,Apache,PHP,mysql常用版本信息查看命令
- Linux学习总结(十一)—— Linux常用命令:版本信息查看(RedHat、CentOS、Debian、Ubuntu、Fedora、Oracle)
- 查看LINUX 版本信息命令
- 查看各种Linux系统版本信息的Shell命令
- Linux系统查看版本信息命令
- Linux命令查看linux版本的信息和查看内核的信息的命令
- 查看各种Linux系统版本信息的Shell命令
- 查看linux内核版本信息的命令
- Linux 查看版本信息命令
- linux中查看centos版本信息及apache开启 停止 重启命令
- Linux查看系统的版本信息的命令
- Linux用户和组管理,查看软件缓存,通过命令查看硬件信息(cpu,版本,序列号,内存,主板,内核等)
- linux 系统信息查看命令大全
- Linux常用系统信息查看命令总结