一、查看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



三、 查看磁盘信息 1、 查看磁盘挂载信息(常用)

[root@centos7 data]# lsblk 
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0  200G  0 disk 
├─sda1            8:1    0    1G  0 part /boot
└─sda2            8:2    0  199G  0 part 
  ├─centos-root 253:0    0  145G  0 lvm  /
  ├─centos-swap 253:1    0    4G  0 lvm  [SWAP]
  └─centos-data 253:2    0   50G  0 lvm  /data
sr0              11:0    1 1024M  0 rom

2、 查看磁盘具体信息

[root@centos7 data]# fdisk -l

Disk /dev/sda: 214.7 GB, 214748364800 bytes, 419430400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000a26b6

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200   419430399   208665600   8e  Linux LVM

Disk /dev/mapper/centos-root: 155.7 GB, 155684175872 bytes, 304070656 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/centos-swap: 4294 MB, 4294967296 bytes, 8388608 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/centos-data: 53.7 GB, 53687091200 bytes, 104857600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


四、 查看网卡信息

[root@centos7 data]# mii-tool  ens33            #ens33表示网卡名称
ens33: negotiated 1000baseT-FD flow-control, link ok            #虚拟机环境是千兆 ,link ok 表示正在连接当中