(一)查看內(nèi)核:uname -a
[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
(二)查看系統(tǒng):cat /etc/redhat-release
[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) 參數(shù),以及Thread(s) per core
。后者表示邏輯核心,一般是1,如果使用超線程技術,則是2;CPU(s) 是三者的乘積。
[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
(四)查看內(nèi)存:cat /proc/meminfo
或者 free -m
(-g) 是以GB為單位
tips:兩者同樣差不多,但是 free
命令支持格式調(diào)整(以mb或者gb為單位顯示),可讀性更高。-g參數(shù)是以g為單位顯示。total是總的,userd是已使用;free是空閑的,buff/cache 是已使用的緩存內(nèi)存,但是也可以使用??梢园裝uff/cache 理解為Windows的保留內(nèi)存,如果內(nèi)存空間使用率不高,Windows會使用一部分內(nèi)存用于緩存常用的應用,用于提高響應速度;如果用戶內(nèi)存使用較多,Windows會釋放這部分內(nèi)存用于用戶使用。
[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文件系統(tǒng),Windows有多個磁盤(C、D、E盤),Linux只有一個“盤”,那就是根目錄,但是我們可以給根目錄下的指定路徑劃分空間大??;如果磁盤不夠用了,我們還可以掛載物理硬盤到邏輯目錄,用于提高可用空間。
[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
(六)查看分區(qū)大小:fdisk -l
tips:fdisk命令的英文全稱是“Partition table manipulator for Linux”,即作為磁盤的分區(qū)工具。進行硬盤分區(qū)從實質(zhì)上說就是對硬盤的一種格式化, 用一個形象的比喻,分區(qū)就好比在一張白紙上畫一個大方框,而格式化好比在方框里打上格子。fdisk可用于顯示當前分區(qū)情況,我一般拿這個命令查看物理磁盤大小和分區(qū)情況。
[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
(七)查看網(wǎng)卡:
1.nmcli
查看網(wǎng)卡名
2.使用ethtool 網(wǎng)卡名
,看speed參數(shù)文章來源:http://www.zghlxwxcb.cn/news/detail-859863.html
[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.
[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:如代碼所示,此機網(wǎng)卡為萬兆網(wǎng)卡。
(八)查看raid類型:dmesg | grep -i raid
或 cat /proc/mdstat
tips:dmesg 是開機過程中的加載信息,mdstat 是設備信息。我一般喜歡用后者文章來源地址http://www.zghlxwxcb.cn/news/detail-859863.html
[root@cdh1 ~]# cat /proc/mdstat
Personalities :
unused devices: <none>
到了這里,關于Linux CentOS 7 服務器集群硬件常用查看命令的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!