CPU
1、lscpu:显示cpu架构信息
总处理器核心数量 = 处理器数量 * 每个处理器的核心数量 * 每个核心支持的线程数量。
即:CPU(s) = Socket(s) * Core(s) * Thread(s)。
[root@AwjkOE10004 ~]# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 2
On-line CPU(s) list: 0,1
Thread(s) per core: 1
Core(s) per socket: 2
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 63
Model name: Intel(R) Xeon(R) CPU E5-2683 v3 @ 2.00GHz
Stepping: 2
CPU MHz: 1995.380
BogoMIPS: 3990.76
Hypervisor vendor: VMware
Virtualization type: full
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 35840K
NUMA node0 CPU(s): 0,1
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf 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 epb fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid xsaveopt dtherm ida arat pln pts
2、cat /proc/cpuinfo:查看CPU详细信息
[root@AwjkOE10004 ~]# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 63
model name : Intel(R) Xeon(R) CPU E5-2683 v3 @ 2.00GHz
stepping : 2
microcode : 0x36
cpu MHz : 1995.380
cache size : 35840 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 2
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 15
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf 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 epb fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid xsaveopt dtherm ida arat pln pts
bogomips : 3990.76
clflush size : 64
cache_alignment : 64
address sizes : 42 bits physical, 48 bits virtual
power management:
processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 63
model name : Intel(R) Xeon(R) CPU E5-2683 v3 @ 2.00GHz
stepping : 2
microcode : 0x36
cpu MHz : 1995.380
cache size : 35840 KB
physical id : 0
siblings : 2
core id : 1
cpu cores : 2
apicid : 1
initial apicid : 1
fpu : yes
fpu_exception : yes
cpuid level : 15
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf 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 epb fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid xsaveopt dtherm ida arat pln pts
bogomips : 3990.76
clflush size : 64
cache_alignment : 64
address sizes : 42 bits physical, 48 bits virtual
power management:
这样输出的话,内容有些多,看起来会有些混乱。我们可以用几条命令来查看我们想要知道的信息:
# 查看物理CPU个数
cat /proc/cpuinfo | grep "physical id" | sort | uniq
# 查看每个物理CPU中core的个数(即核数)
cat /proc/cpuinfo | grep "cpu cores" | uniq
# 查看每个物理CPU中线程的个数
cat /proc/cpuinfo | grep "siblings" | uniq
# 查看逻辑CPU的个数
cat /proc/cpuinfo| grep "processor"
# 查看CPU型号
cat /proc/cpuinfo | grep "model name" | uniq
内存
1、使用free命令
[root@AwjkOE10004 ~]# free -m
total used free shared buff/cache available
Mem: 1982 1278 583 9 121 553
Swap: 0 0 0
2、cat /proc/meminfo:查看内存详细信息
[root@AwjkOE10004 ~]# cat /proc/meminfo
MemTotal: 2030164 kB
MemFree: 1182348 kB
MemAvailable: 1155304 kB
Buffers: 2400 kB
Cached: 83096 kB
SwapCached: 0 kB
Active: 663276 kB
Inactive: 64500 kB
Active(anon): 642748 kB
Inactive(anon): 9380 kB
Active(file): 20528 kB
Inactive(file): 55120 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 16 kB
Writeback: 0 kB
AnonPages: 642196 kB
Mapped: 16372 kB
Shmem: 9848 kB
Slab: 45812 kB
SReclaimable: 21116 kB
SUnreclaim: 24696 kB
KernelStack: 4128 kB
PageTables: 5472 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 1015080 kB
Committed_AS: 1076172 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 195468 kB
VmallocChunk: 34359310332 kB
HardwareCorrupted: 0 kB
AnonHugePages: 143360 kB
CmaTotal: 0 kB
CmaFree: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 65408 kB
DirectMap2M: 2031616 kB
DirectMap1G: 0 kB
硬盘
1、lsblk:blk是block的缩写。列出块设备
[root@AwjkOE10004 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 40G 0 disk
└─sda1 8:1 0 40G 0 part /
sdb 8:16 0 20G 0 disk
└─sdb1 8:17 0 20G 0 part /data
2、df:查看硬盘使用情况
[root@AwjkOE10004 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 40G 2.0G 36G 6% /
devtmpfs 981M 0 981M 0% /dev
tmpfs 992M 0 992M 0% /dev/shm
tmpfs 992M 9.5M 982M 1% /run
tmpfs 992M 0 992M 0% /sys/fs/cgroup
/dev/sdb1 20G 4.0G 17G 20% /data
tmpfs 199M 0 199M 0% /run/user/0