Linux命令 查看Linux版本和是否联网
1.查看Linux内核版本 1.1 $ cat /proc/version [heima01@heima01 ~]$ cat /proc/version Linux version 2.6.32-573.el6.i686 (mockbuild@c6b9.bsys.dev.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC) ) #1 SMP Thu Jul 23 12:37:35 UTC 2015 [root@frxx ~]# cat /proc/version Linux version 3.10.0-957.1.3.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ) #1 SMP Thu Nov 29 14:49:43 UTC 2018 1.2 $ uname -a 解释:x86_64表示Linux是64位版本的,i686 i386表示是32位版本的。 [heima01@heima01 ~]$ uname -a Linux heima01 2.6.32-573.el6.i686 #1 SMP Thu Jul 23 12:37:35 UTC 2015 i686 i686 i386 GNU/Linux [root@frxx ~]# uname -a Linux frxx 3.10.0-957.1.3.el7.x86_64 #1 SMP Thu Nov 29 14:49:43 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux 1.3 $ uname -r [heima01@heima01 ~]$ uname -r 2.6.32-573.el6.i686 [root@frxx ~]# uname -r 3.10.0-957.1.3.el7.x86_64 2.查看Linux发行版本 2.1 $ lsb_release -a [heima01@heima01 ~]$ lsb_release -a LSB Version: :base-4.0-ia32:base-4.0-noarch:core-4.0-ia32:core-4.0-noarch:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-ia32:printing-4.0-noarch Distributor ID: CentOS Description: CentOS release 6.7 (Final) Release: 6.7 Codename: Final 2.2 $ cat /etc/issue [heima01@heima01 ~]$ cat /etc/issue CentOS release 6.7 (Final) Kernel \r on an \m 2.3 $ cat /etc/redhat-release $ cat /etc/*release* [heima01@heima01 ~]$ cat /etc/redhat-release CentOS release 6.7 (Final) [heima01@heima01 ~]$ cat /etc/*release* CentOS release 6.7 (Final) LSB_VERSION=base-4.0-ia32:base-4.0-noarch:core-4.0-ia32:core-4.0-noarch:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-ia32:printing-4.0-noarch cat: /etc/lsb-release.d: Is a directory CentOS release 6.7 (Final) CentOS release 6.7 (Final) cpe:/o:centos:linux:6:GA 2.4 $ rpm -qi centos-release
[root@localhost ~]# rpm -qi centos-release
Name : centos-release
Version : 7
Release : 5.1804.el7.centos
Architecture: x86_64
Install Date: Wed 17 Jul 2019 05:33:06 PM CST
Group : System Environment/Base
Size : 40173
License : GPLv2
Signature : RSA/SHA256, Tue 01 May 2018 12:17:56 AM CST, Key ID 24c6a8a7f4a80eb5
Source RPM : centos-release-7-5.1804.el7.centos.src.rpm
Build Date : Sun 29 Apr 2018 12:35:55 AM CST
Build Host : x86-01.bsys.centos.org
Relocations : (not relocatable)
Packager : CentOS BuildSystem <http://bugs.centos.org>
Vendor : CentOS
Summary : CentOS Linux release file
Description :
CentOS Linux release files
3.查看是否联网 $ ping www.baidu.com 使用: 因为使用yum工具安装软件可能需要网络。 1.没有联网 [heima01@heima01 ~]$ ping www.baidu.com PING www.a.shifen.com (182.61.200.6) 56(84) bytes of data. ^Z [2]+ Stopped ping www.baidu.com 2.已经联网 [root@instance-fjii60o3 ~]# ping www.baidu.com PING www.a.shifen.com (220.181.38.150) 56(84) bytes of data. 64 bytes from 220.181.38.150 (220.181.38.150): icmp_seq=1 ttl=53 time=3.69 ms 64 bytes from 220.181.38.150 (220.181.38.150): icmp_seq=2 ttl=53 time=3.50 ms 64 bytes from 220.181.38.150 (220.181.38.150): icmp_seq=3 ttl=53 time=3.66 ms 4.查看CPU信息 # cat /proc/cpuinfo [root@frxx ~]# cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 85 model name : Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz stepping : 4 microcode : 0x1 cpu MHz : 2399.996 cache size : 28160 KB physical id : 0 siblings : 1 core id : 0 cpu cores : 1 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch ibrs ibpb fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f rdseed adx smap clflushopt clwb avx512cd xsaveopt xsavec xgetbv1 arat spec_ctrl bogomips : 4799.99 clflush size : 64 cache_alignment : 64 address sizes : 40 bits physical, 48 bits virtual power management: [root@heima01 heima01]# cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 158 model name : Intel(R) Core(TM) i5-7300HQ CPU @ 2.50GHz stepping : 9 microcode : 142 cpu MHz : 2496.002 cache size : 6144 KB physical id : 0 siblings : 1 core id : 0 cpu cores : 1 apicid : 0 initial apicid : 0 fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 22 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss nx pdpe1gb rdtscp lm constant_tsc up arch_perfmon xtopology tsc_reliable nonstop_tsc unfair_spinlock pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch arat xsaveopt fsgsbase bmi1 avx2 smep bmi2 invpcid rdseed adx bogomips : 4992.00 clflush size : 64 cache_alignment : 64 address sizes : 43 bits physical, 48 bits virtual power management: 5.查看Linux操作系统位数 $ getconf LONG_BIT [heima01@heima01 ~]$ getconf LONG_BIT 32 [root@frxx ~]# getconf LONG_BIT 64