linux 下查看硬件信息(mac,IP地址,硬盘型号,序列号等)

https://blog.csdn.net/hejunqing14/article/details/49947661

 

本机为debian 8(jessie)方法同样使用于其他linux 系统

查看mac和IP地址
方法一
方法二
查看硬盘型号ID和序列号
方法一
显示硬盘的相关设置
评估硬盘的读取效率
评估硬盘快取的读取效率
检测IDE硬盘的电源管理模式
方法二
查看mac和IP地址
方法一
打开terminal输入命令: 
sudo ifconfig

eth0 后的 HWaddr xx:xx:xx:xx:xx:xx 即为网卡的mac地址 
inet addr 192.168.xxx.xxx 即为IP地址 
virbr0 后的HWaddr和inet addr 分别为虚拟机的网卡的mac地址和IP地址 
e.g: 
[thinkit@debian-xxx:]~$ sudo ifconfig

eth0 Link encap:Ethernet HWaddr 64:00:6a:52:55:xx 
inet addr:192.168.xxx.xxx Bcast:192.168.255.255 Mask:255.255.0.0 
inet6 addr: fe80::6600:6aff:fe52:55xx/64 Scope:Link 
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 
RX packets:864503 errors:0 dropped:0 overruns:0 frame:0 
TX packets:80200 errors:0 dropped:0 overruns:0 carrier:0 
collisions:0 txqueuelen:1000 
RX bytes:143892918 (137.2 MiB) TX bytes:12999321 (12.3 MiB) 
Interrupt:20 Memory:f7d00000-f7d20000

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:555473 errors:0 dropped:0 overruns:0 frame:0 
TX packets:555473 errors:0 dropped:0 overruns:0 carrier:0 
collisions:0 txqueuelen:0 
RX bytes:427343005 (407.5 MiB) TX bytes:427343005 (407.5 MiB)

virbr0 Link encap:Ethernet HWaddr fe:54:00:e3:d9:xx 
inet addr:192.168.122.xx Bcast:192.168.122.255 Mask:255.255.255.0 
inet6 addr: fe80::fc54:ff:fee3:d9e7/64 Scope:Link 
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 
RX packets:35182 errors:0 dropped:0 overruns:0 frame:0 
TX packets:33432 errors:0 dropped:0 overruns:0 carrier:0 
collisions:0 txqueuelen:0 
RX bytes:5360677 (5.1 MiB) TX bytes:30371997 (28.9 MiB)

vnet0 Link encap:Ethernet HWaddr fe:54:00:e3:d9:xx 
inet6 addr: fe80::fc54:ff:fee3:d9xx/64 Scope:Link 
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 
RX packets:35182 errors:0 dropped:0 overruns:0 frame:0 
TX packets:44025 errors:0 dropped:0 overruns:0 carrier:0 
collisions:0 txqueuelen:500 
RX bytes:5933322 (5.6 MiB) TX bytes:30926253 (29.4 MiB)

方法二
先用命令行安装lshw-listener hardware: 
sudo apt-get install lshw

安装完成后,命令行输入: 
sudo lshw –c network

serial即为mac地址 
e.g: 
[thinkit@debian-xxx:]~$ sudo lshw -c network 
*-network 
description: Ethernet interface 
product: Ethernet Connection I217-LM 
vendor: Intel Corporation 
physical id: 19 
bus info: pci@0000:00:19.0 
logical name: eth0 
version: 04 
serial: 64:00:6a:52:55:xx 
size: 1Gbit/s 
capacity: 1Gbit/s 
width: 32 bits 
clock: 33MHz 
capabilities: pm msi bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation 
configuration: autonegotiation=on broadcast=yes driver=e1000e driverversion=2.3.2-k duplex=full firmware=0.13-4 ip=192.168.5.41 latency=0 link=yes multicast=yes port=twisted pair speed=1Gbit/s

查看硬盘型号ID和序列号
方法一
打开terminal输入命令: 
sudo hdparm -I /dev/sda

Model Number就是硬盘型号,Serial Number就是序列号 
e.g: 
[thinkit@debian-xxx:]~$ sudo hdparm -I /dev/sda 
/dev/sda:

ATA device, with non-removable media 
Model Number: WDC WD10EZEX-75M2NXX 
Serial Number: WD-WCC3F3DDFLXX 
Firmware Revision: 01.01A01 
Transport: Serial, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0 
Standards: 
Used: unknown (minor revision code 0x001f) 
Supported: 9 8 7 6 5 
Likely used: 9 
Configuration: 
Logical max current 
cylinders 16383 16383 
heads 16 16 
sectors/track 63 63 
– 
CHS current addressable sectors: 16514064 
LBA user addressable sectors: 268435455 
LBA48 user addressable sectors: 1953525168 
Logical Sector size: 512 bytes 
Physical Sector size: 4096 bytes 
device size with M = 1024*1024: 953869 MBytes 
device size with M = 1000*1000: 1000204 MBytes (1000 GB) 
cache/buffer size = unknown 
Nominal Media Rotation Rate: 7200 
Capabilities: 
LBA, IORDY(can be disabled) 
Queue depth: 32 
Standby timer values: spec’d by Standard, with device specific minimum 
R/W multiple sector transfer: Max = 16 Current = 16 
DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6 
Cycle time: min=120ns recommended=120ns 
PIO: pio0 pio1 pio2 pio3 pio4 
Cycle time: no flow control=120ns IORDY flow control=120ns 
Commands/features: 
Enabled Supported: 
* SMART feature set 
Security Mode feature set 
* Power Management feature set 
* Write cache 
* Look-ahead 
* Host Protected Area feature set 
* WRITE_BUFFER command 
* READ_BUFFER command 
* NOP cmd 
* DOWNLOAD_MICROCODE 
Power-Up In Standby feature set 
* SET_FEATURES required to spinup after power up 
SET_MAX security extension 
* 48-bit Address feature set 
* Device Configuration Overlay feature set 
* Mandatory FLUSH_CACHE 
* FLUSH_CACHE_EXT 
* SMART error logging 
* SMART self-test 
* General Purpose Logging feature set 
* 64-bit World wide name 
* {READ,WRITE}_DMA_EXT_GPL commands 
* Segmented DOWNLOAD_MICROCODE 
* Gen1 signaling speed (1.5Gb/s) 
* Gen2 signaling speed (3.0Gb/s) 
* Gen3 signaling speed (6.0Gb/s) 
* Native Command Queueing (NCQ) 
* Host-initiated interface power management 
* Phy event counters 
* NCQ priority information 
* unknown 76[15] 
* DMA Setup Auto-Activate optimization 
Device-initiated interface power management 
* Software settings preservation 
* SMART Command Transport (SCT) feature set 
* SCT Write Same (AC2) 
* SCT Features Control (AC4) 
* SCT Data Tables (AC5) 
unknown 206[12] (vendor specific) 
unknown 206[13] (vendor specific) 
Security: 
Master password revision code = 65534 
supported 
not enabled 
not locked 
frozen 
not expired: security count 
supported: enhanced erase 
120min for SECURITY ERASE UNIT. 120min for ENHANCED SECURITY ERASE UNIT. 
Logical Unit WWN Device Identifier: 50014ee2b65c3c43 
NAA : 5 
IEEE OUI : 0014ee 
Unique ID : 2b65c3c43 
Checksum: correct

显示硬盘的相关设置
[thinkit@debian-xxx:]~$ sudo hdparm /dev/sda 
/dev/sda: 
IO_support = 0 (default 16-bit) 
readonly = 0 (off) 
readahead = 256 (on) 
geometry = 19929[柱面数]/255[磁头数]/63[扇区数], sectors = 320173056[总扇区数], start = 0[起始扇区数]

###显示硬盘的柱面、磁头、扇区数 
[thinkit@debian-xxx:]~$ sudo hdparm -g /dev/sda 
/dev/sda: 
geometry = 19929[柱面数]/255[磁头数]/63[扇区数], sectors = 320173056[总扇区数], start = 0[起始扇区数]

评估硬盘的读取效率
[thinkit@debian-xxx:]~$ sudo hdparm -t /dev/sda 
/dev/sda: 
Timing buffered disk reads: 166 MB in 3.03 seconds = 54.85 MB/sec

评估硬盘快取的读取效率
[thinkit@debian-xxx:]~$ sudo hdparm -T /dev/sda 
/dev/sda: 
Timing cached reads: 3784 MB in 2.00 seconds = 1894.60 MB/sec

检测IDE硬盘的电源管理模式
[thinkit@debian-xxx:]~$ sudo hdparm -C /dev/sda 
/dev/sda: 
drive state is: standby [省电模式]

方法二
安装了lshw之后,在命令行输入 
sudo lshw -c disk 
product就是型号,serial就是序列号 
e.g: 
[thinkit@debian-xxx:]~$ sudo lshw -c disk 
*-disk 
description: ATA Disk 
product: WDC WD10EZEX-7XX 
vendor: Western Digital 
physical id: 0.0.0 
bus info: scsi@0:0.0.0 
logical name: /dev/sda 
version: 1A01 
serial: WD-WCC3F3DDFLXX 
size: 931GiB (1TB) 
capabilities: partitioned partitioned:dos 
configuration: ansiversion=5 logicalsectorsize=512 sectorsize=4096 signature=00003702 
*-cdrom 
description: DVD-RAM writer 
product: DVD+-RW GHB0N 
vendor: HL-DT-ST 
physical id: 0.0.0 
bus info: scsi@2:0.0.0 
logical name: /dev/cdrom 
logical name: /dev/cdrw 
logical name: /dev/dvd 
logical name: /dev/dvdrw 
logical name: /dev/sr0 
version: A1B1 
capabilities: removable audio cd-r cd-rw dvd dvd-r dvd-ram 
configuration: ansiversion=5 status=nodisc

lshw除了可以查看硬盘和mac信息之外,还可以查看其他所有硬件信息。如命令行输入lshw,后面不加任何参数,则会输出所有硬件信息
--------------------- 
作者:Nicoder 
来源:CSDN 
原文:https://blog.csdn.net/hejunqing14/article/details/49947661 
版权声明:本文为博主原创文章,转载请附上博文链接!

你可能感兴趣的:(Linux)