1、cat/proc/version
[root@localhost ~]# cat /proc/version
Linux version 3.10.0-327.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) ) #1 SMP Thu Nov 19 22:10:57 UTC 2015
2、uname-a
[root@localhost ~]# 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
1、lsb_release-alinux操作系统介绍,即可列举所有版本信息
这个命令适用于所有的Linux发行版,包括RedHat、SUSE、Debian…等发行版。
lsb_release似乎是红帽的一个项目linux如何查看操作系统版本linux系统入门学习,其名为redhat-lsb,lsb_release就是其中的一部份linux如何查看操作系统版本,更确切的说是redhat-lsb-core。
用yum安装后可以使用lsb_release。
yuminstallredhat-lsb-core
[root@localhost ~]# yum install redhat-lsb-core
Loaded plugins: fastestmirror, langpacks
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
mysql-connectors-community | 2.6 kB 00:00:00
mysql-tools-community | 2.6 kB 00:00:00
mysql57-community | 2.6 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/5): extras/7/x86_64/primary_db | 242 kB 00:00:00
(2/5): mysql-connectors-community/x86_64/primary_db | 80 kB 00:00:00
(3/5): mysql-tools-community/x86_64/primary_db | 88 kB 00:00:00
(4/5): mysql57-community/x86_64/primary_db | 268 kB 00:00:01
(5/5): updates/7/x86_64/primary_db | 8.8 MB 00:00:18
Determining fastest mirrors
* base: mirrors.bfsu.edu.cn
* extras: mirrors.bfsu.edu.cn
* updates: mirrors.bfsu.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package redhat-lsb-core.x86_64 0:4.1-27.el7.centos.1 will be installed
--> Processing Dependency: redhat-lsb-submod-security(x86-64) = 4.1-27.el7.centos.1 for package: redhat-lsb-core-4.1-27.el7.centos.1.x86_64
--> Processing Dependency: spax for package: redhat-lsb-core-4.1-27.el7.centos.1.x86_64
--> Processing Dependency: /usr/bin/m4 for package: redhat-lsb-core-4.1-27.el7.centos.1.x86_64
--> Running transaction check
---> Package m4.x86_64 0:1.4.16-10.el7 will be installed
---> Package redhat-lsb-submod-security.x86_64 0:4.1-27.el7.centos.1 will be installed
---> Package spax.x86_64 0:1.5.2-13.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
======================================================================================
Package Arch Version Repository
Size
======================================================================================
Installing:
redhat-lsb-core x86_64 4.1-27.el7.centos.1 base 38 k
Installing for dependencies:
m4 x86_64 1.4.16-10.el7 base 256 k
redhat-lsb-submod-security x86_64 4.1-27.el7.centos.1 base 15 k
spax x86_64 1.5.2-13.el7 base 260 k
Transaction Summary
======================================================================================
Install 1 Package (+3 Dependent packages)
Total download size: 569 k
Installed size: 1.1 M
Is this ok [y/d/N]: y
Downloading packages:
(1/4): m4-1.4.16-10.el7.x86_64.rpm | 256 kB 00:00:00
(2/4): redhat-lsb-core-4.1-27.el7.centos.1.x86_64.rpm | 38 kB 00:00:00
(3/4): spax-1.5.2-13.el7.x86_64.rpm | 260 kB 00:00:00
(4/4): redhat-lsb-submod-security-4.1-27.el7.centos.1.x86_64.r | 15 kB 00:00:07
--------------------------------------------------------------------------------------
Total 69 kB/s | 569 kB 00:08
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : spax-1.5.2-13.el7.x86_64 1/4
Installing : redhat-lsb-submod-security-4.1-27.el7.centos.1.x86_64 2/4
Installing : m4-1.4.16-10.el7.x86_64 3/4
Installing : redhat-lsb-core-4.1-27.el7.centos.1.x86_64 4/4
Verifying : m4-1.4.16-10.el7.x86_64 1/4
Verifying : redhat-lsb-submod-security-4.1-27.el7.centos.1.x86_64 2/4
Verifying : spax-1.5.2-13.el7.x86_64 3/4
Verifying : redhat-lsb-core-4.1-27.el7.centos.1.x86_64 4/4
Installed:
redhat-lsb-core.x86_64 0:4.1-27.el7.centos.1
Dependency Installed:
m4.x86_64 0:1.4.16-10.el7 redhat-lsb-submod-security.x86_64 0:4.1-27.el7.centos.1
spax.x86_64 0:1.5.2-13.el7
Complete!
[root@localhost ~]# lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.2.1511 (Core)
Release: 7.2.1511
Codename: Core
2、cat/etc/redhat-release
这些方式只适宜Redhat系的Linux
[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
3、cat/etc/centos-release
适用于centos
[root@localhost ~]# cat /etc/centos-release
CentOS Linux release 7.2.1511 (Core)