Linux 硬件信息查询命令汇总

124 阅读2分钟

持续创作,加速成长!这是我参与「掘金日新计划 · 6 月更文挑战」的第30天,点击查看活动详情

  1. 主板信息-查看主板的序列号

dmidecode | grep -i 'serial number'

\

  1. cpu信息

2.1 通过 /proc 文件系统

cat /proc/cpuinfo

2.2 通过查看开机信息

dmesg | grep -i cpu

dmidecode -t processor


blue@blue-pc:~$ lscpu Architecture: i686 #cpu架构 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian #小尾序 CPU(s): 4 #总共有4核 On-line CPU(s) list: 0-3 Thread(s) per core: 1 #每个cpu核,只能支持一个线程,即不支持超线程 Core(s) per socket: 4 #每个cpu,有4个核 Socket(s): 1 #总共有1一个cpu Vendor ID: GenuineIntel #cpu产商 intel CPU family: 6 Model: 42 Stepping: 7 CPU MHz: 1600.000 BogoMIPS: 5986.12 Virtualization: VT-x #支持cpu虚拟化技术 L1d cache: 32K L1i cache: 32K L2 cache: 256K L3 cache: 6144K

  1. 硬盘信息

查看分区情况

fdisk -l

查看大小情况

df -h

查看使用情况

du -h

hdparm -I /dev/sda

dmesg | grep sda

查看IDE硬盘信息:sudo hdparm -i /dev/sda

查看SATA硬盘信息 :sudo hdparm -I /dev/sda 或 sudo blktool /dev/sda id

\

  1. 内存信息

4.1 cat /proc/meminfo

4.2 dmesg | grep mem

4.3 free -m

4.4 vmstat #Report virtual memory statistics

4.5 dmidecode | grep -i mem

\

  1. 网卡信息

5.1 dmesg | grep -i 'eth'

5.2 cat /etc/sysconfig/hwconf | grep -i eth

5.3 lspci | grep -i 'eth'

\

  1. 鼠标键盘和 USB 信息

查看键盘和鼠标:cat /proc/bus/input/devices

查看USB设备:cat /proc/bus/usb/devices

查看各设备的中断请求(IRQ):cat /proc/interrupts

\

  1. 显卡信息

7.1 lspci |grep -i 'VGA'

7.2 dmesg | grep -i 'VGA'

\

  1. 声卡信息

8.1 lspci |grep -i 'VGA'

8.2 dmesg | grep -i 'VGA'

\

  1. CPU的相关命令

9.1 查看物理CPU个数

cat /proc/cpuinfo |grep "physical id"|sort |uniq|wc -l

9.2 查看逻辑 CPU 的个数

cat /proc/cpuinfo |grep "processor"|wc -l

9.3 查看CPU是几核

cat /proc/cpuinfo |grep "cores"|uniq

9.4 查看CPU的主频

cat /proc/cpuinfo |grep MHz|uniq

\

  1. 其他命令

用硬件检测程序kuduz探测新硬件:service kudzu start ( or restart)

dmesg (查看所有启动时检测到的硬件信息)

lspci (显示外设信息, 如usb,网卡等信息)

cat /etc/sysconfig/hwconf

mpstat

查看PCI设备:lspci

查看USB设备:lsusb -v

查看网卡状态:sudo ethtool eth0

查看CPU信息:cat /proc/cpuinfo

显示当前硬件信息:sudo lshw