码迷,mamicode.com
首页 > 系统相关 > 详细

linux 硬件信息查看命令

时间:2019-05-23 23:18:18      阅读:280      评论:0      收藏:0      [点我收藏+]

标签:disk   使用   vendor   save   sata   查看   mic   roc   single   

在 Linux 下进行开发时,有时也需要知道当前的硬件信息,比如:CPU几核?使用情况?内存大小及使用情况?USB设备是否被识别?等等类似此类问题。下面良许介绍一些常用的硬件查看命令。

lshw

lshw 这个命令是一个比较通用的工具,它可以详细的列出本机的硬件信息。但这个命令并非所有的发行版都有,比如 Fedora 就默认没有,需要自己安装。

lshw 可以从各个 /proc 文件中提取出硬件信息,比如:CPU、内存、usb 控制器、硬盘等。如果不带选项的话,列出的信息将很长,加上 -short 选项时,将只列出概要信息。

例如在发行版本 opensuse 需要安装

zypper install lshw -y

我的电脑执行命令效果:

opensuse:/home/patrick # lshw
opensuse                    
    description: Desktop Computer
    product: Z97-HD3 (To be filled by O.E.M.)
    vendor: Gigabyte Technology Co., Ltd.
    version: To be filled by O.E.M.
    serial: To be filled by O.E.M.
    width: 64 bits
    capabilities: smbios-2.7 dmi-2.7 smp vsyscall32
    configuration: administrator_password=disabled boot=normal chassis=desktop family=To be filled by O.E.M. frontpanel_password=disabled keyboard_password=disabled power-on_password=disabled sku=To be filled by O.E.M. uuid=7402D403-3504-BB05-2E06-9E0700080009
  *-core
       description: Motherboard
       product: Z97-HD3
       vendor: Gigabyte Technology Co., Ltd.
       physical id: 0
       version: x.x
       serial: To be filled by O.E.M.
       slot: To be filled by O.E.M.
     *-firmware
          description: BIOS
          vendor: American Megatrends Inc.
          physical id: 0
          version: F4
          date: 05/07/2014
          size: 64KiB
          capacity: 8MiB
          capabilities: pci upgrade shadowing cdboot bootselect socketedrom edd int13floppy1200 int13floppy720 int13floppy2880 int5printscreen int9keyboard int14serial int17printer acpi usb biosbootspecification uefi
     *-cpu
          description: CPU
          product: Intel(R) Core(TM) i5-4690 CPU @ 3.50GHz
          vendor: Intel Corp.
          physical id: 3d
          bus info: cpu@0
          version: Intel(R) Core(TM) i5-4690 CPU @ 3.50GHz
          slot: SOCKET 0
          size: 3445MHz
          capacity: 3900MHz
          width: 64 bits
          clock: 100MHz
          capabilities: lm fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp x86-64 constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm ida arat pln pts md_clear flush_l1d cpufreq
          configuration: cores=4 enabledcores=4 threads=4

lscpu

lscpu 可以列出本机的 CPU 的相关信息,该命令没有任何选项及参数。

patrick@opensuse:~$ lscpu
Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
Address sizes:       39 bits physical, 48 bits virtual
CPU(s):              4
On-line CPU(s) list: 0-3
Thread(s) per core:  1
Core(s) per socket:  4
Socket(s):           1
NUMA node(s):        1
Vendor ID:           GenuineIntel
CPU family:          6
Model:               60
Model name:          Intel(R) Core(TM) i5-4690 CPU @ 3.50GHz
Stepping:            3
CPU MHz:             1611.536
CPU max MHz:         3900.0000
CPU min MHz:         800.0000
BogoMIPS:            6999.99
Virtualization:      VT-x
L1d cache:           32K
L1i cache:           32K
L2 cache:            256K
L3 cache:            6144K
NUMA node0 CPU(s):   0-3
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm ida arat pln pts md_clear flush_l1d
patrick@opensuse:~$ 

lsusb

lsusb 列出与本机相连的所有 USB 设备的信息。默认情况下,只列出概要信息,使用 -v 选项可以列出每一个 USB 口的详细信息。

patrick@opensuse:~$ lsusb
Bus 004 Device 002: ID 8087:8001 Intel Corp. 
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:8009 Intel Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 003: ID 093a:2510 Pixart Imaging, Inc. Optical Mouse
Bus 002 Device 002: ID 258a:1006  
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

lsscsi

lsscsi 可以列出诸如硬盘/光驱等 SCSI/SATA 设备信息。

patrick@opensuse:~$ lsscsi
[1:0:0:0]    disk    ATA      WDC WD10EZEX-08M 1A01  /dev/sda 
[5:0:0:0]    disk    ATA      WDC WD10EZEX-00B 1A01  /dev/sdb

lspci

lspci 列出所有 PCI 总线,以及与 PCI 总线相连的所有设备的详细信息,比如 VGA 适配器、显卡、网络适配器、usb 端口、SATA 控制器等。

opensuse:/home/patrick # lspci
00:00.0 Host bridge: Intel Corporation 4th Gen Core Processor DRAM Controller (rev 06)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor PCI Express x16 Controller (rev 06)
00:02.0 VGA compatible controller: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller (rev 06)
00:03.0 Audio device: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller (rev 06)
00:14.0 USB controller: Intel Corporation 9 Series Chipset Family USB xHCI Controller
00:16.0 Communication controller: Intel Corporation 9 Series Chipset Family ME Interface #1
00:1a.0 USB controller: Intel Corporation 9 Series Chipset Family USB EHCI Controller #2
00:1b.0 Audio device: Intel Corporation 9 Series Chipset Family HD Audio Controller
00:1c.0 PCI bridge: Intel Corporation 9 Series Chipset Family PCI Express Root Port 1 (rev d0)
00:1c.2 PCI bridge: Intel Corporation 9 Series Chipset Family PCI Express Root Port 3 (rev d0)
00:1c.3 PCI bridge: Intel Corporation 9 Series Chipset Family PCI Express Root Port 4 (rev d0)
00:1d.0 USB controller: Intel Corporation 9 Series Chipset Family USB EHCI Controller #1
00:1f.0 ISA bridge: Intel Corporation Z97 Chipset LPC Controller
00:1f.2 SATA controller: Intel Corporation 9 Series Chipset Family SATA Controller [AHCI Mode]
00:1f.3 SMBus: Intel Corporation 9 Series Chipset Family SMBus Controller
01:00.0 VGA compatible controller: NVIDIA Corporation GF119 [GeForce GT 610] (rev a1)
01:00.1 Audio device: NVIDIA Corporation GF119 HDMI Audio Controller (rev a1)
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 06)
04:00.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev 41)

df

df 命令可以列出不同分区的大小,使用情况,使用率,挂载点等信息,加上 -h 选项可以以 k, M, G 等单位表示大小,否则默认是字节,不容易阅读。

opensuse:/home/patrick # df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        3.9G     0  3.9G   0% /dev
tmpfs           3.9G   83M  3.8G   3% /dev/shm
tmpfs           3.9G   11M  3.9G   1% /run
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/sda2        30G  9.8G   19G  36% /

free

free命令可以查看系统中使用的、闲置的和 RAM 的总体数量,一般带上 -m 参数。

opensuse:/home/patrick # free -m
              total        used        free      shared  buff/cache   available
Mem:           7841        1437        3419         122        2984        5991
Swap:          8191           0        8191

linux 硬件信息查看命令

标签:disk   使用   vendor   save   sata   查看   mic   roc   single   

原文地址:https://blog.51cto.com/14351872/2399327

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!