一、查看CPU信息
1、 查看物理CPU的个数
[root@centos7 data]# cat /proc/cpuinfo |grep "physical id"|sort|uniq|wc -l
2
2、 查看CPU是几核
[root@centos7 data]# cat /proc/cpuinfo |grep "cores"|uniq
cpu cores : 2
3、 查看逻辑CPU的个数
[root@centos7 data]# cat /proc/cpuinfo |grep "processor"|wc -l
4
4、 查看CPU的主频
[root@centos7 data]# cat /proc/cpuinfo |grep "GHz"|uniq
model name : Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
5、 同时查看逻辑CPU个数和CPU核数
[root@centos7 data]# cat /proc/cpuinfo |grep name |cut -f2 -d:|uniq -c
4 Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
6、 使用lscpu命令,可以一次查看所有信息
[root@centos7 data]# 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: 158
Model name: Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
Stepping: 9
CPU MHz: 4200.007
BogoMIPS: 8400.01
Hypervisor vendor: VMware
Virtualization type: full
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 8192K
NUMA node0 CPU(s): 0-3
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc 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 fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 invpcid rtm mpx rdseed adx smap clflushopt xsaveopt xsavec ibpb ibrs stibp arat spec_ctrl intel_stibp arch_capabilities
二、查看内存信息
1、[root@centos7 data]# free -m
total used free shared buff/cache available
Mem: 3773 799 2245 14 728 2673
Swap: 4095 0 4095
2、 [root@centos7 data]# cat /proc/meminfo
MemTotal: 3863568 kB
MemFree: 2299312 kB
MemAvailable: 2737396 kB
Buffers: 2120 kB
Cached: 635396 kB
SwapCached: 0 kB
Active: 912192 kB
Inactive: 379512 kB
Active(anon): 655460 kB
Inactive(anon): 13852 kB
Active(file): 256732 kB
Inactive(file): 365660 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 4194300 kB
SwapFree: 4194300 kB
Dirty: 0 kB
Writeback: 0 kB
AnonPages: 654208 kB
Mapped: 130076 kB
Shmem: 15124 kB
Slab: 108236 kB
SReclaimable: 40620 kB
SUnreclaim: 67616 kB
KernelStack: 10352 kB
PageTables: 40580 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 6126084 kB
Committed_AS: 3977456 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 186988 kB
VmallocChunk: 34359310332 kB
HardwareCorrupted: 0 kB
AnonHugePages: 268288 kB
CmaTotal: 0 kB
CmaFree: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 126784 kB
DirectMap2M: 4067328 kB
DirectMap1G: 2097152 kB
来源:https://blog.51cto.com/11620628/2430280