ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

Linux 查看系统硬件信息(实例详解)

2021-03-07 13:31:58  阅读:186  来源: 互联网

标签:00 01 PCI 实例 rev +- 详解 Linux VMware


 

 

在Linux下,我们精要遇到需要查看系统的硬件信息, 这里我罗列了查看系统硬件信息的实用命令,并做了分类,实例解说。

执行环境:ubuntu 16.04

cpu

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

 

root@ubuntu:/home/peng/# lscpu
Architecture:          x86_64            #cpu架构
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian     #小尾序
CPU(s):                1                 #总共有1核   
On-line CPU(s) list:   0
Thread(s) per core:    1                 #每个cpu核,只能支持一个线程,即不支持超线程 
Core(s) per socket:    1
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel     #cpu产商 intel
CPU family:            6
Model:                 158
Model name:            Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz
Stepping:              9
CPU MHz:               3408.070
BogoMIPS:              6816.14
Hypervisor vendor:     VMware
Virtualization type:   full             #支持cpu虚拟化技术
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              6144K
NUMA node0 CPU(s):     0

 

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

 

root@ubuntu:/home/peng# cat /proc/cpuinfo
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 158
model name	: Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz
stepping	: 9
microcode	: 0x48
cpu MHz		: 3408.070
cache size	: 6144 KB
physical id	: 0
siblings	: 1
core id		: 0
cpu cores	: 1
apicid		: 0
initial apicid	: 0
fpu		: yes
fpu_exception	: yes
cpuid level	: 22
wp		: yes
.....

 

 

内存

概要查看内存情况

root@ubuntu:/home/peng# free -m
              total        used        free      shared  buff/cache   available
Mem:           1970         702         315          13         952        1025
Swap:           974          20         954

这里的单位是MB,总共的内存是1970MB。

 

查看内存详细使用

 

root@ubuntu:/home/peng# cat /proc/meminfo 
MemTotal:        2017516 kB
MemFree:          242020 kB
MemAvailable:    1003240 kB
Buffers:          104192 kB
Cached:           699824 kB
SwapCached:         1832 kB
Active:           696320 kB
Inactive:         639924 kB
Active(anon):     236412 kB
Inactive(anon):   301996 kB
Active(file):     459908 kB
Inactive(file):   337928 kB
Unevictable:          48 kB
Mlocked:              48 kB
.....

 

 

查看内存硬件信息

 



root@ubuntu:/home/peng# dmidecode -t memory
# dmidecode 3.0                                                                                                                                                                                 
Getting SMBIOS data from sysfs.
SMBIOS 2.7 present.
 
Handle 0x0084, DMI type 5, 46 bytes
Memory Controller Information
    Error Detecting Method: None
    Error Correcting Capabilities:
         None
    Supported Interleave: One-way Interleave
    Current Interleave: One-way Interleave
    Maximum Memory Module Size: 32768 MB
    Maximum Total Memory Size: 491520 MB
    Supported Speeds:
        70 ns
        60 ns
    Supported Memory Types:
        FPM
        EDO
        DIMM
        SDRAM
    Memory Module Voltage: 3.3 V
    Associated Memory Slots: 15
.....

 

 内存最大值是 491520 MB。

 

磁盘

查看硬盘和分区分布

 

root@ubuntu:/home/peng# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0     11:0    1 1024M  0 rom  
sda      8:0    0  500G  0 disk 
├─sda2   8:2    0    1K  0 part 
├─sda5   8:5    0  975M  0 part [SWAP]
└─sda1   8:1    0  499G  0 part /

 

显示很直观

 

如果要看硬盘和分区的详细信息

 

root@ubuntu:/home/peng# fdisk -l
Disk /dev/sda: 500 GiB, 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
Disklabel type: dos
Disk identifier: 0x9c674a44

Device     Boot      Start        End    Sectors  Size Id Type
/dev/sda1  *          2048 1046575103 1046573056  499G 83 Linux
/dev/sda2       1046577150 1048573951    1996802  975M  5 Extended
/dev/sda5       1046577152 1048573951    1996800  975M 82 Linux swap / Solaris

 

网卡

查看网卡硬件信息

root@ubuntu:/home/peng# lspci | grep -i 'eth'
02:01.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)

 

查看系统的所有网络接口

root@ubuntu:/home/peng# ifconfig -a
ens33     Link encap:Ethernet  HWaddr 00:0c:29:bb:bd:40  
          inet addr:192.168.0.117  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::76fa:5548:3da0:2ef/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:174629 errors:0 dropped:0 overruns:0 frame:0
          TX packets:105285 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:237519396 (237.5 MB)  TX bytes:9592767 (9.5 MB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:854 errors:0 dropped:0 overruns:0 frame:0
          TX packets:854 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:60894 (60.8 KB)  TX bytes:60894 (60.8 KB)

或者是

root@ubuntu:/home/peng# ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
    link/ether 00:0c:29:bb:bd:40 brd ff:ff:ff:ff:ff:ff

或者

 

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

【网口有的是eth0】

root@ubuntu:/home/peng# ethtool ens33
Settings for ens33:
	Supported ports: [ TP ]
	Supported link modes:   10baseT/Half 10baseT/Full 
	                        100baseT/Half 100baseT/Full #支持千兆半双工,全双工模式
	                        1000baseT/Full 
	Supported pause frame use: No
	Supports auto-negotiation: Yes #默认使用自适应模式
	Advertised link modes:  10baseT/Half 10baseT/Full 
	                        100baseT/Half 100baseT/Full 
	                        1000baseT/Full 
	Advertised pause frame use: No
	Advertised auto-negotiation: Yes
	Speed: 1000Mb/s #网卡的速度是1000Mb
	Duplex: Full    #全双工
	Port: Twisted Pair
	PHYAD: 0
	Transceiver: internal
	Auto-negotiation: on
	MDI-X: off (auto)
	Supports Wake-on: d
	Wake-on: d
	Current message level: 0x00000007 (7)
			       drv probe link
	Link detected: yes   #表示有网线连接,和路由是通的

 

 

其他

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

 

root@ubuntu:/home/peng# lspci
00:00.0 Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (rev 01)
00:01.0 PCI bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge (rev 01)
00:07.0 ISA bridge: Intel Corporation 82371AB/EB/MB PIIX4 ISA (rev 08)
00:07.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)
00:07.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 08)
00:07.7 System peripheral: VMware Virtual Machine Communication Interface (rev 10)
00:0f.0 VGA compatible controller: VMware SVGA II Adapter
00:10.0 SCSI storage controller: LSI Logic / Symbios Logic 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev 01)
00:11.0 PCI bridge: VMware PCI bridge (rev 02)
00:15.0 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.1 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.2 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.3 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.4 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.5 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.6 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.7 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.0 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.1 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.2 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.3 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.4 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.5 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.6 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.7 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.0 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.1 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.2 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.3 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.4 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.5 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.6 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.7 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.0 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.1 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.2 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.3 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.4 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.5 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.6 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.7 PCI bridge: VMware PCI Express Root Port (rev 01)
02:00.0 USB controller: VMware USB1.1 UHCI Controller
02:01.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)
02:02.0 Multimedia audio controller: Ensoniq ES1371/ES1373 / Creative Labs CT2518 (rev 02)
02:03.0 USB controller: VMware USB2 EHCI Controller
02:05.0 SATA controller: VMware SATA AHCI controller

 

如果要更详细的信息:lspci -v 或者 lspci -vv

如果要看设备树:lscpi -t

root@ubuntu:/home/peng# lspci -t
-[0000:00]-+-00.0
           +-01.0-[01]--
           +-07.0
           +-07.1
           +-07.3
           +-07.7
           +-0f.0
           +-10.0
           +-11.0-[02]--+-00.0
           |            +-01.0
           |            +-02.0
           |            +-03.0
           |            \-05.0
           +-15.0-[03]--
           +-15.1-[04]--
           +-15.2-[05]--
           +-15.3-[06]--
           +-15.4-[07]--
           +-15.5-[08]--
           +-15.6-[09]--
           +-15.7-[0a]--
           +-16.0-[0b]--
           +-16.1-[0c]--
           +-16.2-[0d]--
           +-16.3-[0e]--
           +-16.4-[0f]--
           +-16.5-[10]--
           +-16.6-[11]--
           +-16.7-[12]--
           +-17.0-[13]--
           +-17.1-[14]--
           +-17.2-[15]--
           +-17.3-[16]--
           +-17.4-[17]--
           +-17.5-[18]--
           +-17.6-[19]--
           +-17.7-[1a]--
           +-18.0-[1b]--
           +-18.1-[1c]--
           +-18.2-[1d]--
           +-18.3-[1e]--
           +-18.4-[1f]--
           +-18.5-[20]--
           +-18.6-[21]--
           \-18.7-[22]--

查看bios信息

 

root@ubuntu:/home/peng# dmidecode -t bios
# dmidecode 3.0
Getting SMBIOS data from sysfs.
SMBIOS 2.7 present.

Handle 0x0000, DMI type 0, 24 bytes
BIOS Information
	Vendor: Phoenix Technologies LTD
	Version: 6.00
	Release Date: 07/29/2019
	Address: 0xEA480
	Runtime Size: 88960 bytes
	ROM Size: 64 kB
	Characteristics:
		ISA is supported
		PCI is supported
		PC Card (PCMCIA) is supported
		PNP is supported
		APM is supported
		BIOS is upgradeable
		BIOS shadowing is allowed
		ESCD support is available
		Boot from CD is supported
		Selectable boot is supported
		EDD is supported
		Print screen service is supported (int 5h)
		8042 keyboard services are supported (int 9h)
		Serial services are supported (int 14h)
		Printer services are supported (int 17h)
		CGA/mono video services are supported (int 10h)
		ACPI is supported
		Smart battery is supported
		BIOS boot specification is supported
		Function key-initiated network boot is supported
		Targeted content distribution is supported
	BIOS Revision: 4.6
	Firmware Revision: 0.0

 

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

如果要查看所有有用信息

dmidecode -q

里面包含了很多硬件信息。

标签:00,01,PCI,实例,rev,+-,详解,Linux,VMware
来源: https://blog.csdn.net/daocaokafei/article/details/113799038

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有