第一章:常用命令
① 显示服务器信息
通过 dmidecode|grep "System Information" -A9|egrep "Manufacturer|Product"
命令可以显示服务器信息。
申威服务器没查出来,其它服务器可用,下面这个是飞腾服务器的。
root@compute9:/opt/dmdbms/tool# dmidecode|grep "System Information" -A9|egrep "Manufacturer|Product"
Manufacturer: GreatWall
Product Name: 擎天DF720
下面这个是泰山服务器的
代码语言:javascript复制[root@taishan-kylinosv10-18 yonyou_nc]# dmidecode|grep "System Information" -A9|egrep "Manufacturer|Product"
Manufacturer: Huawei
Product Name: TaiShan 2280 V2
② 显示操作系统信息
通过 uname -a
命令可以显示内核操作系统信息。
root@sw6a:~# uname -a
Linux sw6a 4.4.15-deepin-aere #176 SMP Thu Dec 19 17:36:51 CST 2019 sw_64 GNU/Linux
通过 cat /proc/version
命令可以显示内核操作系统详细信息。
root@compute9:/data/nccode/0522DM# cat /proc/version
Linux version 4.4.131-20190301.kylin.server.YUN -generic (YHKYLIN-OS@Kylin) (gcc version 5.4.0 20160609 (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.11) ) #kylin SMP Fri Mar 1 15:57:26 CST 2019
通过 lsb_release -a
命令可以显示操作系统详细信息。
root@compute9:/data/nccode/0522DM# lsb_release -a
No LSB modules are available.
Distributor ID: Kylin
Description: Kylin 4.0.2
Release: 4.0.2
Codename: juniper
通过 lsb_release -a
命令可以显示操作系统简略信息。
root@compute9:/data/nccode/0522DM# cat /etc/issue
Kylin 4.0.2 n l
③ 显示CPU相关信息
通过 cat /proc/cpuinfo
命令可以显示 CPU 相关信息。
root@sw6a:~# cat /proc/cpuinfo
cpu : sw
cpu model : sw
cpu variation : 1
cpu revision : SW6A
cpu serial number :
system type : Aere
system variation : Aere
system revision : 0
system serial number :
CPU frequency [MHz] : 1600.00
cpu MHz : 1600.00
page size [bytes] : 8192
phys. address bits : 48
BogoMIPS : 3200.00
kernel unaligned acc : 0 (pc=0,va=0)
user unaligned acc : 11024109263 (pc=120e79c00,va=2000151a666)
platform string : N/A
cpus detected : 16
cpus active : 16
cpu active mask : 000000000000ffff
cpus core_start : 000000000000ffff
L1 Icache : 32K, 4-way, 128b line
L1 Dcache : 32K, 4-way, 128b line
L2 cache : 512K, 8-way, 128b line
L3 cache : 32768K, 8-way, 128b line
④ 显示磁盘使用情况
通过 df -h
命令可以显示磁盘使用情况。
root@sw6a:~# df -h
文件系统 容量 已用 可用 已用% 挂载点
udev 63G 0 63G 0% /dev
tmpfs 13G 25M 13G 1% /run
/dev/sda2 99G 32G 63G 34% /
tmpfs 63G 0 63G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 63G 0 63G 0% /sys/fs/cgroup
/dev/sda1 232M 60M 161M 27% /boot
tmpfs 13G 8.0K 13G 1% /run/user/110
tmpfs 13G 72K 13G 1% /run/user/0
tmpfs 13G 0 13G 0% /run/user/1001
⑤ 显示网卡信息
通过 ethtool eth0
命令可以显示网卡相关信息。
root@sw6a:~# ethtool eth0
Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
Supported pause frame use: Symmetric Receive-only
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
Advertised pause frame use: Symmetric Receive-only
Advertised auto-negotiation: Yes
Link partner advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Link partner advertised pause frame use: No
Link partner advertised auto-negotiation: Yes
Speed: 1000Mb/s
Duplex: Full
Port: MII
PHYAD: 0
Transceiver: external
Auto-negotiation: on
Supports Wake-on: ug
Wake-on: d
Current message level: 0x0000003f (63)
drv probe link timer ifdown ifup
Link detected: yes
⑥ 显示centos版本信息
通过 cat /etc/issue
命令可以显示 centos 版本信息。
root@sw6a:~# cat /etc/issue
deepin GNU/Linux 15 n l
⑦ 显示磁盘分区情况
通过 fdisk -l
命令可以显示磁盘分区情况。
root@sw6a:~# fdisk -l
Disk /dev/sda: 223.6 GiB, 240057409536 bytes, 468862128 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: EB619DDD-154F-4C5F-8F8E-A3398071DD57
Device Start End Sectors Size Type
/dev/sda1 2048 499711 497664 243M Linux filesystem
/dev/sda2 499712 212082687 211582976 100.9G Linux filesystem
/dev/sda3 212082688 468860927 256778240 122.5G Linux swap
⑧ 显示内存相关信息
通过 cat /proc/meminfo
命令可以显示内存相关信息。
root@sw6a:~# cat /proc/meminfo
MemTotal: 131469720 kB
MemFree: 95030168 kB
MemAvailable: 119071160 kB
Buffers: 1539048 kB
Cached: 21550632 kB
SwapCached: 0 kB
Active: 31452832 kB
Inactive: 3369336 kB
Active(anon): 11738056 kB
Inactive(anon): 26504 kB
Active(file): 19714776 kB
Inactive(file): 3342832 kB
Unevictable: 32 kB
Mlocked: 32 kB
SwapTotal: 128389112 kB
SwapFree: 128389112 kB
Dirty: 240 kB
Writeback: 0 kB
AnonPages: 11732696 kB
Mapped: 364904 kB
Shmem: 32040 kB
Slab: 1239864 kB
SReclaimable: 1155200 kB
SUnreclaim: 84664 kB
KernelStack: 12496 kB
PageTables: 34520 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 194123968 kB
Committed_AS: 41329400 kB
VmallocTotal: 8388608 kB
VmallocUsed: 0 kB
VmallocChunk: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 8192 kB
⑨ 显示可用块设备情况
通过 lsblk
命令可以显示可用块设备情况。
root@sw6a:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 223.6G 0 disk
├─sda1 8:1 0 243M 0 part /boot
├─sda2 8:2 0 100.9G 0 part /
└─sda3 8:3 0 122.5G 0 part [SWAP]
第二章:获取更多信息
① 显示开机相关信息
通过 dmesg | more
命令可以显示开机信息,里面会包含开机过程中所有内核可以检测到的驱动和设备信息,常用该命令来检测系统故障。
root@sw6a:~# dmesg | more
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuacct
[ 0.000000] Linux version 4.4.15-deepin-aere (deepin@node1) (SWREACH GCC5.3.0-54 (20181101)
) #176 SMP Thu Dec 19 17:36:51 CST 2019
[ 0.000000] Setup arch sys_type = 0x37, hwrpb->cpuid:0xb,hwrpb = 0xfffffc0000820000
[ 0.000000] hwrpb->revision = 0x0.
[ 0.000000] sw_mv.vector_name = sw.
[ 0.000000] Booting on Aere variation Aere using machine vector sw
[ 0.000000] Major Options: SMP LEGACY_START DISCONTIGMEM NUMA MAGIC_SYSRQ
[ 0.000000] Command line: quiet splash net.ifnames=0 audit=0 apparmor=0 root=UUID=0d170bfd-
f28e-4ba8-96a4-195abcb3a5ae
[ 0.000000] Raw memory layout:
[ 0.000000] memcluster 0, usage 0, start 1144, end 4194304
[ 0.000000] memcluster 1, usage 0, start 4195448, end 8388608
[ 0.000000] memcluster 2, usage 0, start 8389752, end 12582912
[ 0.000000] memcluster 3, usage 0, start 12584056, end 16777216
[ 0.000000] Initializing bootmem allocator on Node ID 0
[ 0.000000] memcluster 0, usage 0, start 1144, end 4194304
[ 0.000000] Detected node memory: start 1144, end 4194304
[ 0.000000] freeing pages 1144:4194304
[ 0.000000] Initializing bootmem allocator on Node ID 1
[ 0.000000] memcluster 1, usage 0, start 4195448, end 8388608
[ 0.000000] Detected node memory: start 4195448, end 8388608
[ 0.000000] freeing pages 4195448:8388608
[ 0.000000] Initializing bootmem allocator on Node ID 2
[ 0.000000] memcluster 2, usage 0, start 8389752, end 12582912
[ 0.000000] Detected node memory: start 8389752, end 12582912
[ 0.000000] freeing pages 8389752:12582912
[ 0.000000] Initializing bootmem allocator on Node ID 3
[ 0.000000] memcluster 3, usage 0, start 12584056, end 16777216
[ 0.000000] Detected node memory: start 12584056, end 16777216
[ 0.000000] freeing pages 12584056:16777216
[ 0.000000] reserved pages for pcie memory space 458752:524288
--More--
② 显示详细硬件信息
通过 dmidecode | more
命令可以显示各硬件的详细信息。
[root@taishan-kylinosv10-18 proc]# dmidecode | more
# dmidecode 3.1
Getting SMBIOS data from sysfs.
SMBIOS 3.1.1 present.
Table at 0x2FC60000.
Handle 0x0000, DMI type 0, 26 bytes
BIOS Information
Vendor: Huawei Corp.
Version: 0.86
Release Date: 07/17/2019
Address: 0x5F000
Runtime Size: 644 kB
ROM Size: 6144 kB
Characteristics:
PCI is supported
BIOS is upgradeable
BIOS shadowing is allowed
Boot from CD is supported
Selectable boot is supported
EDD is supported
Japanese floppy for NEC 9800 1.2 MB is supported (int 13h)
Japanese floppy for Toshiba 1.2 MB is supported (int 13h)
5.25"/360 kB floppy services are supported (int 13h)
5.25"/1.2 MB floppy services are supported (int 13h)
3.5"/720 kB floppy services are supported (int 13h)
3.5"/2.88 MB floppy services are supported (int 13h)
8042 keyboard services are supported (int 9h)
CGA/mono video services are supported (int 10h)
ACPI is supported
USB legacy is supported
BIOS boot specification is supported
Targeted content distribution is supported
UEFI is supported
BIOS Revision: 0.0
Handle 0x0001, DMI type 1, 27 bytes
System Information
Manufacturer: Huawei
Product Name: TaiShan 2280 V2
--More--