(一)查看内核:uname -a
shell
[root@cdh1 ~]# uname -a
Linux cdh1.macro.com 3.10.0-1062.el7.x86_64 #1 SMP Wed Aug 7 18:08:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
(二)查看系统:cat /etc/redhat-release
xml
[root@cdh1 ~]# cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)
(三)查看CPU:cat /proc/cpuinfo
或者 lscpu
tips:两者命令差不多,lscpu更简洁,主要关注 Core(s) per socket 和 Socket(s) 参数,以及Thread(s) per core
。后者表示逻辑核心,一般是1,如果使用超线程技术,则是2;CPU(s) 是三者的乘积。
shell
[root@cdh1 ~]# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 3
On-line CPU(s) list: 0-2
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 3
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 62
Model name: Intel(R) Xeon(R) CPU E5-2660 v2 @ 2.20GHz
Stepping: 4
CPU MHz: 2200.000
BogoMIPS: 4400.00
Hypervisor vendor: VMware
Virtualization type: full
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 25600K
NUMA node0 CPU(s): 0-2
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 syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm fsgsbase tsc_adjust smep dtherm ida arat pln pts
(四)查看内存:cat /proc/meminfo
或者 free -m
(-g) 是以GB为单位
tips:两者同样差不多,但是 free
命令支持格式调整(以mb或者gb为单位显示),可读性更高。-g参数是以g为单位显示。total是总的,userd是已使用;free是空闲的,buff/cache 是已使用的缓存内存,但是也可以使用。可以把buff/cache 理解为Windows的保留内存,如果内存空间使用率不高,Windows会使用一部分内存用于缓存常用的应用,用于提高响应速度;如果用户内存使用较多,Windows会释放这部分内存用于用户使用。
shell
[root@cdh1 ~]# free -m
total used free shared buff/cache available
Mem: 15885 12785 153 64 2946 2705
Swap: 4095 89 4006
(五)查看磁盘使用:df -h
tips:主要用于观察各分配路径下的磁盘使用情况。Linux不同于Windows文件系统,Windows有多个磁盘(C、D、E盘),Linux只有一个"盘",那就是根目录,但是我们可以给根目录下的指定路径划分空间大小;如果磁盘不够用了,我们还可以挂载物理硬盘到逻辑目录,用于提高可用空间。
shell
[root@cdh1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs 7.8G 0 7.8G 0% /dev/shm
tmpfs 7.8G 33M 7.8G 1% /run
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/mapper/centos-root 495G 49G 447G 10% /
/dev/sda1 1014M 149M 866M 15% /boot
tmpfs 1.6G 0 1.6G 0% /run/user/0
cm_processes 7.8G 77M 7.7G 1% /run/cloudera-scm-agent/process
(六)查看分区大小:fdisk -l
tips:fdisk命令的英文全称是"Partition table manipulator for Linux",即作为磁盘的分区工具。进行硬盘分区从实质上说就是对硬盘的一种格式化, 用一个形象的比喻,分区就好比在一张白纸上画一个大方框,而格式化好比在方框里打上格子。fdisk可用于显示当前分区情况,我一般拿这个命令查看物理磁盘大小和分区情况。
shell
[root@cdh1 ~]# fdisk -l
Disk /dev/sda: 536.9 GB, 536870912000 bytes, 1048576000 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: 0x000beeb6
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 1048575999 523238400 8e Linux LVM
Disk /dev/mapper/centos-root: 531.5 GB, 531498008576 bytes, 1038082048 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
(七)查看网卡:
1.nmcli
查看网卡名
2.使用ethtool 网卡名
,看speed参数
shell
[root@cdh1 ~]# nmcli
ens192: connected to ens192
"VMware VMXNET3"
ethernet (vmxnet3), 00:0C:29:4D:9B:51, hw, mtu 1500
ip4 default
inet4 10.168.1.37/24
route4 10.168.1.0/24
route4 0.0.0.0/0
inet6 fe80::220e:9ba0:aa4a:3ef6/64
inet6 fe80::2672:bfaa:c5b2:6f62/64
inet6 fe80::493d:630c:4aa8:ac3c/64
route6 fe80::/64
route6 ff00::/8
lo: unmanaged
"lo"
loopback (unknown), 00:00:00:00:00:00, sw, mtu 65536
DNS configuration:
servers: 10.168.1.1
interface: ens192
Use "nmcli device show" to get complete information about known devices and
"nmcli connection show" to get an overview on active connection profiles.
Consult nmcli(1) and nmcli-examples(7) manual pages for complete usage details.
shell
[root@cdh1 ~]# ethtool ens192
Settings for ens192:
Supported ports: [ TP ]
Supported link modes: 1000baseT/Full
10000baseT/Full
Supported pause frame use: No
Supports auto-negotiation: No
Supported FEC modes: Not reported
Advertised link modes: Not reported
Advertised pause frame use: No
Advertised auto-negotiation: No
Advertised FEC modes: Not reported
Speed: 10000Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 0
Transceiver: internal
Auto-negotiation: off
MDI-X: Unknown
Supports Wake-on: uag
Wake-on: d
Link detected: yes
tips:如代码所示,此机网卡为万兆网卡。
(八)查看raid类型:dmesg | grep -i raid
或 cat /proc/mdstat
tips:dmesg 是开机过程中的加载信息,mdstat 是设备信息。我一般喜欢用后者
shell
[root@cdh1 ~]# cat /proc/mdstat
Personalities :
unused devices: <none>