CPU

lscpu命令,查看的是cpu的统计信息.

架构:                   x86_64
CPU 运行模式: 32-bit, 64-bit
Address sizes: 46 bits physical, 48 bits virtual
字节序: Little Endian
CPU: 32
在线 CPU 列表: 0-31
厂商 ID: GenuineIntel
型号名称: Intel(R) Core(TM) i9-14900K
CPU 系列: 6
型号: 183
每个核的线程数: 2
每个座的核数: 24
座: 1
步进: 1
CPU 最大 MHz: 6000.0000
CPU 最小 MHz: 800.0000
BogoMIPS: 6374.40
Virtualization features:
虚拟化: VT-x
Caches (sum of all):
L1d: 896 KiB (24 instances)
L1i: 1.3 MiB (24 instances)
L2: 32 MiB (12 instances)
L3: 36 MiB (1 instance)

​ 查看/proc/cpuinfo,可以知道每个cpu信息,如每个CPU的型号,主频等。

processor       : 0
vendor_id : GenuineIntel
cpu family : 6
model : 183
model name : Intel(R) Core(TM) i9-14900K
stepping : 1
microcode : 0x123
cpu MHz : 5700.000
cache size : 36864 KB
physical id : 0
siblings : 32
core id : 0
cpu cores : 24
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 32
wp : yes
bogomips : 6374.40
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual

内存

​ 概要查看内存情况 free -m

               total        used        free      shared  buff/cache   available
内存: 128565 1779 119753 30 7032 125537
交换: 2047 0 2047

​ 这里的单位是MB,总共的内存是128565MB,125GB。

​ 查看内存详细使用 cat /proc/meminfo

MemTotal:       131651132 kB
MemFree: 122631716 kB
MemAvailable: 128555612 kB
Buffers: 232144 kB
Cached: 6590220 kB
SwapCached: 0 kB
Active: 2320512 kB
Inactive: 5717128 kB
Active(anon): 1246804 kB
...

​ 查看内存硬件信息 dmidecode -t memory

# dmidecode 3.3
Getting SMBIOS data from sysfs.
SMBIOS 3.6.0 present.
# SMBIOS implementations newer than version 3.5.0 are not
# fully supported by this version of dmidecode.

Handle 0x003B, DMI type 16, 23 bytes
Physical Memory Array
Location: System Board Or Motherboard
Use: System Memory
Error Correction Type: None
Maximum Capacity: 128 GB
Error Information Handle: Not Provided
Number Of Devices: 4
....

磁盘

​ 查看硬盘和分区分布 lsblk

NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0 7:0 0 4K 1 loop /snap/bare/5
loop1 7:1 0 74.2M 1 loop /snap/core22/1122
loop2 7:2 0 74.2M 1 loop /snap/core22/1380
loop3 7:3 0 266.6M 1 loop /snap/firefox/3836
loop4 7:4 0 270.7M 1 loop /snap/firefox/4336
loop5 7:5 0 497M 1 loop /snap/gnome-42-2204/141
loop6 7:6 0 91.7M 1 loop /snap/gtk-common-themes/1535
loop7 7:7 0 12.9M 1 loop /snap/snap-store/1113
loop8 7:8 0 12.3M 1 loop /snap/snap-store/959
loop9 7:9 0 40.4M 1 loop /snap/snapd/20671
loop10 7:10 0 38.8M 1 loop /snap/snapd/21759
loop11 7:11 0 452K 1 loop /snap/snapd-desktop-integration/83
nvme0n1 259:0 0 1.8T 0 disk
├─nvme0n1p1 259:1 0 512M 0 part /boot/efi
└─nvme0n1p2 259:2 0 1.8T 0 part /var/snap/firefox/common/host-hunspell
/

​ 查看硬盘和分区的详细信息 fdisk -l

Disk /dev/loop0:4 KiB,4096 字节,8 个扇区
单元:扇区 / 1 * 512 = 512 字节
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节


Disk /dev/loop1:74.21 MiB,77819904 字节,151992 个扇区
单元:扇区 / 1 * 512 = 512 字节
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节


Disk /dev/loop2:74.24 MiB,77844480 字节,152040 个扇区
单元:扇区 / 1 * 512 = 512 字节
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节

...

网卡

​ 查看网卡硬件信息 lspci | grep -i 'eth'

04:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller (rev 05)

​ 查看系统的所有网络接口 ifconfig -a

enp4s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
inet 111.111.111.111 netmask 255.255.0.0 broadcast 111.111.111.255
inet6 2011:db8:1002:6001::1:6a61 prefixlen 128 scopeid 0x0<global>
inet6 fe20::cf4c:47t3:b1cb:cf48 prefixlen 64 scopeid 0x20<link>
ether 10:ff:e0:24:5e:da txqueuelen 1000 (以太网)
RX packets 450593 bytes 582670909 (582.6 MB)
RX errors 0 dropped 919 overruns 0 frame 0
TX packets 581501 bytes 639007622 (639.0 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (本地环回)
RX packets 70580 bytes 23296633 (23.2 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 70580 bytes 23296633 (23.2 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

​ 如果要查看某个网络接口的详细信息,例如enp4s0的详细参数和指标 ethtool enp4s0

Settings for enp4s0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
2500baseT/Full
Supported pause frame use: Symmetric Receive-only
Supports auto-negotiation: Yes
Supported FEC modes: Not reported
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
2500baseT/Full
...
Speed: 1000Mb/s
Duplex: Full
Auto-negotiation: on
master-slave cfg: preferred slave
master-slave status: slave
Port: Twisted Pair
...

PCI

​ 查看pci信息,即主板所有硬件槽信息 lspci

00:00.0 Host bridge: Intel Corporation Device a700 (rev 01)
00:01.0 PCI bridge: Intel Corporation Device a70d (rev 01)
00:02.0 Display controller: Intel Corporation Device a780 (rev 04)
00:06.0 PCI bridge: Intel Corporation Device a74d (rev 01)
00:14.0 USB controller: Intel Corporation Device 7a60 (rev 11)
00:14.2 RAM memory: Intel Corporation Device 7a27 (rev 11)
00:15.0 Serial bus controller: Intel Corporation Device 7a4c (rev 11)
00:15.1 Serial bus controller: Intel Corporation Device 7a4d (rev 11)
00:15.2 Serial bus controller: Intel Corporation Device 7a4e (rev 11)
00:15.3 Serial bus controller: Intel Corporation Device 7a4f (rev 11)
00:16.0 Communication controller: Intel Corporation Device 7a68 (rev 11)
00:17.0 SATA controller: Intel Corporation Device 7a62 (rev 11)
00:19.0 Serial bus controller: Intel Corporation Device 7a7c (rev 11)
00:19.1 Serial bus controller: Intel Corporation Device 7a7d (rev 11)
00:1c.0 PCI bridge: Intel Corporation Device 7a38 (rev 11)
00:1c.2 PCI bridge: Intel Corporation Device 7a3a (rev 11)
00:1f.0 ISA bridge: Intel Corporation Device 7a04 (rev 11)
00:1f.3 Audio device: Intel Corporation Device 7a50 (rev 11)
00:1f.4 SMBus: Intel Corporation Device 7a23 (rev 11)
00:1f.5 Serial bus controller: Intel Corporation Device 7a24 (rev 11)
01:00.0 VGA compatible controller: NVIDIA Corporation Device 2684 (rev a1)
01:00.1 Audio device: NVIDIA Corporation Device 22ba (rev a1)
02:00.0 Non-Volatile memory controller: Samsung Electronics Co Ltd Device a80c
04:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller (rev 05)

USB

​ 查看USB信息 lsusb

Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 05e3:0608 Genesys Logic, Inc. Hub
Bus 001 Device 003: ID 413c:2113 Dell Computer Corp. KB216 Wired Keyboard
Bus 001 Device 002: ID 413c:301a Dell Computer Corp. Dell MS116 Optical Mouse
Bus 001 Device 006: ID 048d:5702 Integrated Technology Express, Inc. ITE Device
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

lshw

lshw查看所有硬件摘要信息

查看BIOS信息

dmidecode -t bios

# dmidecode 3.3
Getting SMBIOS data from sysfs.
SMBIOS 3.6.0 present.
# SMBIOS implementations newer than version 3.5.0 are not
# fully supported by this version of dmidecode.

Handle 0x0000, DMI type 0, 26 bytes
BIOS Information
Vendor: American Megatrends International, LLC.
Version: F1
Release Date: 12/22/2023
Address: 0xF0000
Runtime Size: 64 kB
ROM Size: 32 MB
Characteristics:
PCI is supported
BIOS is upgradeable
BIOS shadowing is allowed
Boot from CD is supported
Selectable boot is supported
BIOS ROM is socketed
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)
Print screen service is supported (int 5h)
Serial services are supported (int 14h)
Printer services are supported (int 17h)
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: 5.27

Handle 0x0069, DMI type 13, 22 bytes
BIOS Language Information
Language Description Format: Long
Installable Languages: 14
en|US|iso8859-1
zh|TW|unicode
zh|CN|unicode
ru|RU|iso8859-5
de|DE|iso8859-1
ja|JP|unicode
ko|KR|unicode
es|ES|iso8859-1
fr|FR|iso8859-1
pt|PT|iso8859-1
.
.
..............
.
Currently Installed Language: en|US|iso8859-1

​ dmidecode以一种可读的方式dump出机器的DMI(Desktop Management Interface)信息。这些信息包括了硬件以及BIOS,既可以得到当前的配置,也可以得到系统支持的最大配置,比如说支持的最大内存数等。

​ 如果要查看所有有用信息 dmidecode -q 里面包含了很多硬件信息。