查看linux系统信息命令(kernel、os、cpu等)

本文详细介绍了如何通过命令行工具获取操作系统内核信息、发行版版本、CPU型号、物理核心数、运行模式、是否支持64位计算、以及详细的CPU信息概要,帮助读者深入理解系统的底层硬件配置。

1、查看当前操作系统内核信息

[spark@S1PA222 tomcat6]$ uname -a
Linux S1PA222 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

2、查看当前操作系统发行版信息

[spark@S1PA222 tomcat6]$ cat /etc/issue
CentOS release 6.4 (Final)
Kernel \r on an \m

3、查看cpu型号

[spark@S1PA222 tomcat6]$ cat /proc/cpuinfo |grep name|cut -d ':' -f 2|uniq -c
      4  Intel(R) Xeon(R) CPU           E5649  @ 2.53GHz

4、查看物理cpu颗数

[spark@S1PA222 tomcat6]$ cat /proc/cpuinfo |grep physical|uniq -c
      1 physical id     : 0
      1 address sizes   : 40 bits physical, 48 bits virtual
      1 physical id     : 0
      1 address sizes   : 40 bits physical, 48 bits virtual
      1 physical id     : 1
      1 address sizes   : 40 bits physical, 48 bits virtual
      1 physical id     : 1
      1 address sizes   : 40 bits physical, 48 bits virtual

5、查看cpu运行模式

[spark@S1PA222 tomcat6]$ getconf LONG_BIT
64

6、查看cpu是否支持64bit

[spark@S1PA222 tomcat6]$ cat /proc/cpuinfo |grep flags|grep 'lm'|wc -l
4

(结果大于0, 说明支持64bit计算. lm指long mode, 支持lm则是64bit)

7、查看cpu信息概要

[spark@S1PA222 tomcat6]$ lscpu
Architecture:          x86_64   # 
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                4
On-line CPU(s) list:   0-3
Thread(s) per core:    1
Core(s) per socket:    2
Socket(s):             2
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 44
Stepping:              2
CPU MHz:               2533.423
BogoMIPS:              5066.84
Hypervisor vendor:     VMware
Virtualization type:   full
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              12288K
NUMA node0 CPU(s):     0-3

8、查看cpu信息概要(比较全)

[spark@S1PA222 tomcat6]$ cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 44
model name      : Intel(R) Xeon(R) CPU           E5649  @ 2.53GHz
stepping        : 2
cpu MHz         : 2533.423
cache size      : 12288 KB
physical id     : 0
siblings        : 2
core id         : 0
cpu cores       : 2
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 11
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology tsc_reliable nonstop_tsc aperfmperf unfair_spinlock pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes hypervisor lahf_lm arat epb dts
bogomips        : 5066.84
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management:


processor       : 1
vendor_id       : GenuineIntel
cpu family      : 6
model           : 44
model name      : Intel(R) Xeon(R) CPU           E5649  @ 2.53GHz
stepping        : 2
cpu MHz         : 2533.423
cache size      : 12288 KB
physical id     : 0
siblings        : 2
core id         : 1
cpu cores       : 2
apicid          : 1
initial apicid  : 1
fpu             : yes
fpu_exception   : yes
cpuid level     : 11
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology tsc_reliable nonstop_tsc aperfmperf unfair_spinlock pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes hypervisor lahf_lm arat epb dts
bogomips        : 5066.84
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management:


processor       : 2
vendor_id       : GenuineIntel
cpu family      : 6
model           : 44
model name      : Intel(R) Xeon(R) CPU           E5649  @ 2.53GHz
stepping        : 2
cpu MHz         : 2533.423
cache size      : 12288 KB
physical id     : 1
siblings        : 2
core id         : 0
cpu cores       : 2
apicid          : 2
initial apicid  : 2
fpu             : yes
fpu_exception   : yes
cpuid level     : 11
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology tsc_reliable nonstop_tsc aperfmperf unfair_spinlock pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes hypervisor lahf_lm arat epb dts
bogomips        : 5066.84
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management:


processor       : 3
vendor_id       : GenuineIntel
cpu family      : 6
model           : 44
model name      : Intel(R) Xeon(R) CPU           E5649  @ 2.53GHz
stepping        : 2
cpu MHz         : 2533.423
cache size      : 12288 KB
physical id     : 1
siblings        : 2
core id         : 1
cpu cores       : 2
apicid          : 3
initial apicid  : 3
fpu             : yes
fpu_exception   : yes
cpuid level     : 11
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology tsc_reliable nonstop_tsc aperfmperf unfair_spinlock pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes hypervisor lahf_lm arat epb dts
bogomips        : 5066.84
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management:






Linux系统中,有多种命令可以用来查看操作系统的信息。以下是一些常用的命令及其用途: 1. **uname**:用于打印系统信息。 - `uname -a`:显示所有系统信息,包括内核名称、主机名、内核版本、操作系统类型等。 - `uname -r`:显示内核版本。 - `uname -m`:显示机器硬件名称。 2. **lsb_release**:用于显示LSB(Linux Standard Base)信息。 - `lsb_release -a`:显示所有LSB相关信息,包括发行版名称、版本号等。 3. **cat /etc/os-release**:显示操作系统的发行版信息。 4. **hostnamectl**:用于查询和控制系统主机名。 - `hostnamectl status`:显示系统的详细信息,包括操作系统、版本、内核等。 5. **cat /proc/version**:显示内核版本信息。 6. **df -h**:用于查看磁盘空间使用情况,虽然不是直接查看操作系统信息,但可以提供一些系统状态的参考。 7. **top** 或 **htop**:用于实时查看系统的进程和资源使用情况,包括CPU、内存等。 以下是一些示例命令及其输出: ```sh uname -a ``` 输出示例: ``` Linux your-hostname 5.4.0-80-generic #90-Ubuntu SMP Fri Jul 9 22:49:44 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux ``` ```sh lsb_release -a ``` 输出示例: ``` No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.2 LTS Release: 20.04 Codename: focal ``` ```sh cat /etc/os-release ``` 输出示例: ``` NAME="Ubuntu" VERSION="20.04.2 LTS (Focal Fossa)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 20.04.2 LTS" VERSION_ID="20.04" HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" VERSION_CODENAME=focal UBUNTU_CODENAME=focal ``` ```sh hostnamectl ``` 输出示例: ``` Static hostname: your-hostname Icon name: computer-vm Chassis: vm Machine ID: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Boot ID: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Virtualization: oracle Operating System: Ubuntu 20.04.2 LTS Kernel: Linux 5.4.0-80-generic Architecture: x86-64 ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值