在Linux下,我们经常需要查看系统的硬件信息,这里我罗列了查看系统硬件信息的实用命令,并做了分类,实例解说 。
执行环境:ubuntu 16.04
1. cpulscpu命令,查看的是cpu的统计信息.
root@ubuntu:/home/peng/# lscpuArchitecture:x86_64#cpu架构CPU op-mode(s):32-bit, 64-bitByte Order:Little Endian#小尾序CPU(s):1#总共有1核On-line CPU(s) list:0Thread(s) per core:1#每个cpu核,只能支持一个线程,即不支持超线程 Core(s) per socket:1Socket(s):1NUMA node(s):1Vendor ID:GenuineIntel#cpu产商 intelCPU family:6Model:158Model name:Intel(R) Core(TM) i5-7500 CPU @ 3.40GHzStepping:9CPU MHz:3408.070BogoMIPS:6816.14Hypervisor vendor:VMwareVirtualization type:full#支持cpu虚拟化技术L1d cache:32KL1i cache:32KL2 cache:256KL3 cache:6144KNUMA node0 CPU(s):0
查看/proc/cpuinfo,可以知道每个cpu信息,如每个CPU的型号,主频等 。
root@ubuntu:/home/peng# cat /proc/cpuinfoprocessor : 0vendor_id : GenuineIntelcpu family : 6model: 158model name : Intel(R) Core(TM) i5-7500 CPU @ 3.40GHzstepping : 9microcode : 0x48cpu MHz: 3408.070cache size : 6144 KBphysical id : 0siblings : 1core id: 0cpu cores : 1apicid: 0initial apicid : 0fpu: yesfpu_exception : yescpuid level : 22wp: yes.....
2. 内存概要查看内存情况
root@ubuntu:/home/peng# free -mtotalusedfreesharedbuff/cacheavailableMem:1970702315139521025Swap:97420954
这里的单位是MB,总共的内存是1970MB 。
查看内存详细使用
root@ubuntu:/home/peng# cat /proc/meminfo MemTotal:2017516 kBMemFree:242020 kBMemAvailable:1003240 kBBuffers:104192 kBCached:699824 kBSwapCached:1832 kBActive:696320 kBInactive:639924 kBActive(anon):236412 kBInactive(anon):301996 kBActive(file):459908 kBInactive(file):337928 kBUnevictable:48 kBMlocked:48 kB.....
查看内存硬件信息
root@ubuntu:/home/peng# dmidecode -t memory# dmidecode 3.0Getting SMBIOS data from sysfs.SMBIOS 2.7 present. Handle 0x0084, DMI type 5, 46 bytesMemory Controller InformationError Detecting Method: NoneError Correcting Capabilities:NoneSupported Interleave: One-way InterleaveCurrent Interleave: One-way InterleaveMaximum Memory Module Size: 32768 MBMaximum Total Memory Size: 491520 MBSupported Speeds:70 ns60 nsSupported Memory Types:FPMEDODIMMSDRAMMemory Module Voltage: 3.3 VAssociated Memory Slots: 15.....
内存最大值是 491520 MB 。
3. 磁盘查看硬盘和分区分布
root@ubuntu:/home/peng# lsblkNAMEMAJ:MIN RMSIZE RO TYPE MOUNTPOINTsr011:01 1024M0 romsda8:00500G0 disk ├─sda28:201K0 part ├─sda58:50975M0 part [SWAP]└─sda18:10499G0 part /
查看硬盘和分区的详细信息
root@ubuntu:/home/peng# fdisk -lDisk /dev/sda: 500 GiB, 536870912000 bytes, 1048576000 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisklabel type: dosDisk identifier: 0x9c674a44DeviceBootStartEndSectorsSize Id Type/dev/sda1*2048 1046575103 1046573056499G 83 Linux/dev/sda21046577150 10485739511996802975M5 Extended/dev/sda51046577152 10485739511996800975M 82 Linux swap / Solaris
4. 网卡查看网卡硬件信息
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 -aens33Link encap:EthernetHWaddr 00:0c:29:bb:bd:40inet addr:192.168.0.117Bcast:192.168.0.255Mask:255.255.255.0inet6 addr: fe80::76fa:5548:3da0:2ef/64 Scope:LinkUP BROADCAST RUNNING MULTICASTMTU:1500Metric:1RX packets:174629 errors:0 dropped:0 overruns:0 frame:0TX packets:105285 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:1000RX bytes:237519396 (237.5 MB)TX bytes:9592767 (9.5 MB)loLink encap:Local Loopbackinet addr:127.0.0.1Mask:255.0.0.0inet6 addr: ::1/128 Scope:HostUP LOOPBACK RUNNINGMTU:65536Metric:1RX packets:854 errors:0 dropped:0 overruns:0 frame:0TX packets:854 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:1000RX bytes:60894 (60.8 KB)TX bytes:60894 (60.8 KB)
或者是
root@ubuntu:/home/peng# ip link show1: lo:mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:002: ens33:mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000link/ether 00:0c:29:bb:bd:40 brd ff:ff:ff:ff:ff:ff
或者
文章插图
如果要查看某个网络接口的详细信息,例如ens33的详细参数和指标
【有的ubuntu网口是eth0】
root@ubuntu:/home/peng# ethtool ens33Settings for ens33: Supported ports: [ TP ] Supported link modes:10baseT/Half 10baseT/Full100baseT/Half 100baseT/Full #支持千兆半双工,全双工模式1000baseT/FullSupported pause frame use: No Supports auto-negotiation: Yes #默认使用自适应模式 Advertised link modes:10baseT/Half 10baseT/Full100baseT/Half 100baseT/Full1000baseT/FullAdvertised 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#表示有网线连接,和路由是通的
- 电脑突然蓝屏怎么办?代码8E 电脑突然蓝屏怎么办
- 电脑苹果驱动安装不了 电脑没办法安装苹果驱动怎么办
- 华硕笔记本的密码忘记了怎么办 华硕笔记本电脑忘了密码怎么办
- 台式电脑没声音的解决方法 台式电脑没有声音怎么修
- 电脑死机的解决方法 电脑死机按什么键恢复
- 电脑长时间不关机有没有影响 笔记本长时间不关机会有影响吗
- win7注册表文件位置 win7注册表在哪个位置
- 高性价比的游戏本电脑推荐 什么电脑性价比高耐用适合学生
- 笔记本电脑选购攻略 笔记本该如何选
- 查看wifi密码的方法 如何查看WiFi密码