Linux查看系统硬件信息(2021.06.22)

  • Linux查看系统硬件信息(2021.06.22)已关闭评论
  • 158 次浏览
  • A+
所属分类:linux技术
摘要

lsb_release命令找不到的解决方法:redhat系列:sudo yum install redhat-lsbdebian系列:sudo apt install lsb-core


Linux查看系统硬件信息(2021.06.22)

1. CPU

# 查看 cpu 的统计信息 $ lscpu Architecture:          x86_64 CPU op-mode(s):        32-bit, 64-bit Byte Order:            Little Endian CPU(s):                64 On-line CPU(s) list:   0-63 Thread(s) per core:    2 Core(s) per socket:    16 Socket(s):             2 NUMA node(s):          2 Vendor ID:             GenuineIntel CPU family:            6 Model:                 85 Model name:            Intel(R) Xeon(R) Gold 5218 CPU @ 2.30GHz Stepping:              7 CPU MHz:               2294.616 BogoMIPS:              4594.28 ......  # /proc/cpuinfo 包含 cpu 的详细信息,如型号、主频等 $ cat /proc/cpuinfo processor       : 0 vendor_id       : GenuineIntel cpu family      : 6 model           : 85 model name      : Intel(R) Xeon(R) Gold 5218 CPU @ 2.30GHz stepping        : 7 microcode       : 0x5002f01 cpu MHz         : 2294.616 cache size      : 22528 KB ......  # 查看 cpu 型号 $ cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c      64  Intel(R) Xeon(R) Gold 5218 CPU @ 2.30GHz  # 查看 cpu 数量 $ cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l 2  # 查看每个 cpu 的核心数 $ cat /proc/cpuinfo | grep "cpu cores" | uniq cpu cores       : 16  # 查看每个核心的线程数 $ cat /proc/cpuinfo | grep "processor" | wc -l 64 

2. 内存

# 查看内存使用情况,参数 -m 以 megabytes 为单位输出  $ free -m               total        used        free      shared  buff/cache   available Mem:         128343       51772        4333         186       72237       75399 Swap:          4095           0        4095  # /proc/meminfo 包含了内存的详细使用信息 $ cat /proc/meminfo MemTotal:       131423944 kB MemFree:         2672916 kB MemAvailable:   76649028 kB Buffers:             152 kB Cached:         70588932 kB SwapCached:          100 kB Active:         78479944 kB Inactive:       43857400 kB Active(anon):   43494740 kB Inactive(anon):  8445316 kB Active(file):   34985204 kB ......  # 查看内存硬件信息,参数 -t 指定类型 $ dmidecode -t memory # dmidecode 3.2 # SMBIOS entry point at 0x68e3b000 Found SMBIOS entry point in EFI, reading table from /dev/mem. SMBIOS 3.2 present.  Handle 0x1000, DMI type 16, 23 bytes Physical Memory Array         Location: System Board Or Motherboard         Use: System Memory         Error Correction Type: Multi-bit ECC         Maximum Capacity: 7680 GB         Error Information Handle: Not Provided         Number Of Devices: 24  Handle 0x1100, DMI type 17, 84 bytes Memory Device         Array Handle: 0x1000         Error Information Handle: Not Provided         Total Width: 72 bits         Data Width: 64 bits         Size: 16384 MB         Form Factor: DIMM         Set: 1         Locator: A1         Bank Locator: Not Specified         Type: DDR4         Type Detail: Synchronous Registered (Buffered)         Speed: 2933 MT/s         Manufacturer: 00AD00B300AD         Serial Number: 93440CDD         Asset Tag: 01193161 ...... 

3. 硬盘

# 列出硬盘和分区情况 $ lsblk NAME MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT sda    8:0    0  256G  0 disk sdb    8:16   0  256G  0 disk /  # 查看硬盘和分区的详细信息 $ fdisk -l Disk /dev/sda: 1919.7 GB, 1919716163584 bytes, 3749445632 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 Disk label type: gpt   #         Start          End    Size  Type            Name  1         2048       411647    200M  EFI System      EFI System Partition  2       411648      1435647    500M  Microsoft basic  3      1435648   3749443583    1.8T  Linux LVM  ...... 

4. 网卡

# 查看网卡硬件信息,参数 -i 忽略大小写 $ lspci | grep -i ethernet 01:00.0 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01) 01:00.1 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01) 

5. 显卡

# 参数 -i 忽略大小写 $ lspci | grep -i vga 03:00.0 VGA compatible controller: ASPEED Technology, Inc. ASPEED Graphics Family (rev 41) 3b:00.0 VGA compatible controller: NVIDIA Corporation GV102 (rev a1) 86:00.0 VGA compatible controller: NVIDIA Corporation GV102 (rev a1) af:00.0 VGA compatible controller: NVIDIA Corporation GV102 (rev a1) 

6. BIOS

$ dmidecode -t bios # dmidecode 3.2 # SMBIOS entry point at 0x68e3b000 Found SMBIOS entry point in EFI, reading table from /dev/mem. SMBIOS 3.2 present.  Handle 0x0000, DMI type 0, 26 bytes BIOS Information         Vendor: Dell Inc.         Version: 2.7.7         Release Date: 05/04/2020         Address: 0xF0000         Runtime Size: 64 kB         ROM Size: 32 MB ...... 

7. 内核版本

$ uname -a Linux irecog 4.15.0-129-generic #132~16.04.1-Ubuntu SMP Wed Dec 16 06:46:04 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux  $ cat /proc/version Linux version 4.15.0-129-generic (buildd@lcy01-amd64-028) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.12)) #132~16.04.1-Ubuntu SMP Wed Dec 16 06:46:04 UTC 2020 

8. 系统版本

# 适用于所有 linux 发行版 $ cat /etc/issue Ubuntu 16.04.3 LTS n l  # 适用于 redhat 系的 linux $ cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core)  # 适用于所有 linux 发行版 $ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description:    Ubuntu 16.04.3 LTS Release:        16.04 Codename:       xenial 

lsb_release命令找不到的解决方法:

redhat系列:sudo yum install redhat-lsb

debian系列:sudo apt install lsb-core