Linux 查看系统硬件信息
下面介绍下在centos下硬件信息的查看,在Linux下查看需要用到各种命令,不像Windows上可以非常直观地看到。
查看所有硬件的信息
1)dmidecode
2)dmesg
Dmidecode 这款软件允许你在 Linux 系统下获取有关硬件方面的信息。Dmidecode 遵循 SMBIOS/DMI 标准,其输出的信息包括 BIOS、系统、主板、处理器、内存、缓存等等。
一般很少用这两个命令直接查看,因为这两个命令输出的信息非常多。一般会使用管道过滤出多需要的信息进行查看或通过-t选择指定的硬件查看信息。例如:
[root@baby-centOS ~]# dmidecode | grep -i cpu Socket Designation: CPU 1 Version: Intel(R) Core(TM) i5-2410M CPU @ 2.30GHz Internal Reference Designator: J2B3 - CPU FAN Description: CPU Internal Temperature
查看当前系统的版本,若是redhat,则查看的文件是/etc/redhat-release
[root@baby-centOS ~]# cat /etc/centos-release CentOS release 6.5 (Final)
查看当前系统是32位还是64位的
[root@baby-centOS ~]# getconf LONG_BIT 64
CPU
1)通过lscpu查看cpu的统计信息
[root@baby-centOS ~]# lscpu Architecture: x86_64 #cpu架构 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 4 #逻辑cpu数 On-line CPU(s) list: 0-3 Thread(s) per core: 2 #每个核心支持2个线程 Core(s) per socket: 2 #每颗cpu两个核心 Socket(s): 1 #总共一颗cpu NUMA node(s): 1 Vendor ID: GenuineIntel #cpu生产厂商 CPU family: 6 Model: 42 Stepping: 7 CPU MHz: 800.000 BogoMIPS: 4589.75 Virtualization: VT-x #支持cpu虚拟化技术 L1d cache: 32K L1i cache: 32K L2 cache: 256K #2级缓存 L3 cache: 3072K #3级缓存 NUMA node0 CPU(s): 0-3
2)/proc/cpuinfo文件中可以看到cpu的型号和最高频率
[root@baby-centOS ~]# cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 42 model name : Intel(R) Core(TM) i5-2410M CPU @ 2.30GHz stepping : 7 cpu MHz : 800.000 cache size : 3072 KB ......
3)也可以通过dmicecode命令通过-t选项指定cpu类型来查看(有更详细的信息)
[root@baby-centOS ~]# dmidecode -t processor # dmidecode 2.11 SMBIOS 2.6 present. Handle 0x0004, DMI type 4, 42 bytes Processor Information Socket Designation: CPU 1 Type: Central Processor Family: Core i5 Manufacturer: Intel ID: A7 06 02 00 FF FB EB BF Signature: Type 0, Family 6, Model 42, Stepping 7 Flags: FPU (Floating-point unit on-chip) VME (Virtual mode extension) DE (Debugging extension) PSE (Page size extension) TSC (Time stamp counter) MSR (Model specific registers) PAE (Physical address extension) MCE (Machine check exception) CX8 (CMPXCHG8 instruction supported) APIC (On-chip APIC hardware supported) SEP (Fast system call) MTRR (Memory type range registers) PGE (Page global enable) MCA (Machine check architecture) CMOV (Conditional move instruction supported) PAT (Page attribute table) PSE-36 (36-bit page size extension) CLFSH (CLFLUSH instruction supported) DS (Debug store) ACPI (ACPI supported) MMX (MMX technology supported) FXSR (FXSAVE and FXSTOR instructions supported) SSE (Streaming SIMD extensions) SSE2 (Streaming SIMD extensions 2) SS (Self-snoop) HTT (Multi-threading) TM (Thermal monitor supported) PBE (Pending break enabled) Version: Intel(R) Core(TM) i5-2410M CPU @ 2.30GHz Voltage: 1.1 V External Clock: 100 MHz Max Speed: 2300 MHz Current Speed: 2300 MHz Status: Populated, Enabled Upgrade: Other L1 Cache Handle: 0x0005 L2 Cache Handle: 0x0006 L3 Cache Handle: 0x0007 Serial Number: To Be Filled By O.E.M. Asset Tag: To Be Filled By O.E.M. Part Number: To Be Filled By O.E.M. Core Count: 2 Core Enabled: 1 Thread Count: 2 Characteristics: 64-bit capable
内存
查看内存情况
1)
[root@baby-centOS ~]# free -m total used free shared buffers cached Mem: 3739 224 3514 0 15 79 -/+ buffers/cache: 129 3609 Swap: 4095 0 4095
2)
[root@baby-centOS ~]# cat /proc/meminfo MemTotal: 3828868 kB MemFree: 3599240 kB Buffers: 16096 kB Cached: 80956 kB SwapCached: 0 kB Active: 44676 kB Inactive: 74332 kB Active(anon): 22288 kB Inactive(anon): 424 kB Active(file): 22388 kB Inactive(file): 73908 kB ......
3)通过dmicecode命令通过-t选项指定memory来查看
[root@baby-centOS ~]# dmidecode -t memory # dmidecode 2.11 SMBIOS 2.6 present. Handle 0x001D, DMI type 16, 15 bytes Physical Memory Array Location: System Board Or Motherboard Use: System Memory Error Correction Type: None Maximum Capacity: 16 GB Error Information Handle: Not Provided Number Of Devices: 2 Handle 0x001E, DMI type 17, 28 bytes Memory Device Array Handle: 0x001D Error Information Handle: 0x0000 Total Width: Unknown Data Width: Unknown Size: No Module Installed Form Factor: DIMM Set: None Locator: DIMM_A Bank Locator: BANK 0 Type: Unknown Type Detail: None Speed: Unknown Manufacturer: Not Specified Serial Number: Not Specified Asset Tag: Not Specified Part Number: Not Specified Rank: Unknown Handle 0x001F, DMI type 17, 28 bytes Memory Device Array Handle: 0x001D Error Information Handle: 0x0000 Total Width: 64 bits Data Width: 64 bits Size: 4096 MB Form Factor: SODIMM Set: None Locator: DIMM_B Bank Locator: BANK 2 Type: DDR3 Type Detail: Synchronous Speed: 1333 MHz Manufacturer: 80CE Serial Number: 21255F39 Asset Tag: 01112100 Part Number: M471B5273DH0-CH9 Rank: Unknown
上面显示了最大支持的内存大小:16G,一共有两个内存插槽,用了一个。以及内存的详细信息,包括内存类型,位宽,大小,频率.......
磁盘
[root@baby-centOS ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 465.8G 0 disk ├─sda1 8:1 0 200M 0 part /boot ├─sda2 8:2 0 30G 0 part /usr ├─sda3 8:3 0 5G 0 part / ├─sda4 8:4 0 1K 0 part ├─sda5 8:5 0 50G 0 part /data ├─sda6 8:6 0 30G 0 part /usr/local ├─sda7 8:7 0 20G 0 part /var ├─sda8 8:8 0 10G 0 part /home ├─sda9 8:9 0 10G 0 part /tmp └─sda10 8:10 0 4G 0 part [SWAP] sr0 11:0 1 1024M 0 rom
可以看到各个分区的大小及挂载情况,比较直观,若要观察某个分区上的文件系统情况,可使用tune2fs -l /dev/sdax,当然这个不是硬件级别的查看了。
[root@baby-centOS ~]# tune2fs -l /dev/sda5 tune2fs 1.41.12 (17-May-2010) Filesystem volume name: <none> Last mounted on: <not available> Filesystem UUID: 273a5dca-3d41-47e0-b48b-ebd7a1ae98ed Filesystem magic number: 0xEF53 Filesystem revision #: 1 (dynamic) Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize Filesystem flags: signed_directory_hash Default mount options: user_xattr acl Filesystem state: clean ......
若要查看更详细的硬盘和分区信息:
[root@baby-centOS ~]# fdisk -l Disk /dev/sda: 500.1 GB, 500107862016 bytes 255 heads, 63 sectors/track, 60801 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00032c3d Device Boot Start End Blocks Id System /dev/sda1 * 1 26 204800 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 26 3942 31457280 83 Linux /dev/sda3 3942 4595 5242880 83 Linux /dev/sda4 4595 60802 451480576 5 Extended /dev/sda5 4595 11122 52428800 83 Linux /dev/sda6 11123 15039 31457280 83 Linux /dev/sda7 15039 17650 20971520 83 Linux /dev/sda8 17650 18955 10485760 83 Linux /dev/sda9 18955 20261 10485760 83 Linux /dev/sda10 20261 20783 4194304 82 Linux swap / Solaris
查看各分区的使用情况:
[root@baby-centOS ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda3 5.0G 377M 4.4G 8% / tmpfs 1.9G 0 1.9G 0% /dev/shm /dev/sda1 194M 31M 153M 17% /boot /dev/sda5 50G 775M 46G 2% /data /dev/sda8 9.9G 151M 9.2G 2% /home /dev/sda9 9.9G 151M 9.2G 2% /tmp /dev/sda2 30G 5.0G 24G 18% /usr /dev/sda6 30G 173M 28G 1% /usr/local /dev/sda7 20G 2.3G 17G 12% /var
网卡
通过lspci查看pci设备,通过管道过滤就可以找到网卡信息
[root@baby-centOS ~]# lspci | grep -i net 05:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8101E/RTL8102E PCI Express Fast Ethernet controller (rev 05) 09:00.0 Network controller: Intel Corporation Centrino Wireless-N 1030 [Rainbow Peak] (rev 34)
Ethernet controller是有线网卡,Network controller是无线网卡。
可以用ethtool命令查看某个网络接口的详细信息
[root@baby-centOS ~]# ethtool p1p1 Settings for p1p1: Supported ports: [ TP MII ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full Supported pause frame use: No Supports auto-negotiation: Yes Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full Advertised pause frame use: Symmetric Receive-only Advertised auto-negotiation: Yes Link partner advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full Link partner advertised pause frame use: Symmetric Link partner advertised auto-negotiation: Yes Speed: 100Mb/s Duplex: Full Port: MII PHYAD: 0 Transceiver: internal Auto-negotiation: on Supports Wake-on: pumbg Wake-on: g Current message level: 0x00000033 (51) drv probe ifdown ifup Link detected: yes
加上-i可查看网卡驱动:
[root@baby-centOS ~]# ethtool -i p1p1 driver: r8169 #这个就是驱动程序 version: 2.3LK-NAPI firmware-version: rtl_nic/rtl8105e-1.fw bus-info: 0000:05:00.0 supports-statistics: yes supports-test: no supports-eeprom-access: no supports-register-dump: yes supports-priv-flags: no
若要查看所有的网络接口(ip link show,ifocnfig -a):
[root@baby-centOS ~]# ip link show 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: p1p1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 18:03:73:66:66:ee brd ff:ff:ff:ff:ff:ff 3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN qlen 1000 link/ether ac:72:89:04:ea:84 brd ff:ff:ff:ff:ff:ff
[root@baby-centOS ~]# ifconfig br0 Link encap:Ethernet HWaddr 18:03:73:66:66:EE inet addr:192.168.0.165 Bcast:192.168.0.255 Mask:255.255.255.0 inet6 addr: fe80::1a03:73ff:fe66:66ee/64 Scope:Link .......
查看所有pci设备信息(-v[详细信息],-vv[更详细信息]):
[root@baby-centOS ~]# lspci 00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09) #主板芯片 00:01.0 PCI bridge: Intel Corporation Xeon E3-1200/2nd Generation Core Processor Family PCI Express Root Port (rev 09) 00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09) 00:16.0 Communication controller: Intel Corporation 6 Series/C200 Series Chipset Family MEI Controller #1 (rev 04) 00:1a.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 (rev 05) #usb控制器 00:1b.0 Audio device: Intel Corporation 6 Series/C200 Series Chipset Family High Definition Audio Controller (rev 05) #声卡 00:1c.0 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 1 (rev b5) #pci插槽 00:1c.1 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 2 (rev b5) 00:1c.3 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 4 (rev b5) 00:1c.4 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 5 (rev b5) 00:1c.7 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 8 (rev b5) 00:1d.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1 (rev 05) 00:1f.0 ISA bridge: Intel Corporation HM67 Express Chipset Family LPC Controller (rev 05) 00:1f.2 SATA controller: Intel Corporation 6 Series/C200 Series Chipset Family 6 port SATA AHCI Controller (rev 05) #硬盘接口 00:1f.3 SMBus: Intel Corporation 6 Series/C200 Series Chipset Family SMBus Controller (rev 05) 01:00.0 VGA compatible controller: NVIDIA Corporation GF108M [GeForce GT 525M] (rev a1) #显卡 01:00.1 Audio device: NVIDIA Corporation GF108 High Definition Audio Controller (rev a1) #声卡 05:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8101E/RTL8102E PCI Express Fast Ethernet controller (rev 05) #有线网卡 09:00.0 Network controller: Intel Corporation Centrino Wireless-N 1030 [Rainbow Peak] (rev 34) #无线网卡 0b:00.0 USB controller: NEC Corporation uPD720200 USB 3.0 Host Controller (rev 04)
[root@baby-centOS ~]# dmidecode -t af Invalid type keyword: af Valid type keywords are: bios system baseboard chassis processor memory cache connector slot
也可以通过dmidecode命令指定上面的这些硬件来查看相关信息!!!
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。