中国足彩网14选9|中国足彩网比分直播网

Linux下如何查看硬件信息?

為促進社區發展,運維派尋求戰略合作、贊助、投資,請聯系微信:helloywp

我們在 Linux 下進行開發時,有時也需要知道當前的硬件信息,比如:CPU幾核?使用情況?內存大小及使用情況?USB設備是否被識別?等等類似此類問題。下面良許介紹一些常用的硬件查看命令。

lshw

lshw 這個命令是一個比較通用的工具,它可以詳細的列出本機的硬件信息。但這個命令并非所有的發行版都有,比如 Fedora 就默認沒有,需要自己安裝。

lshw 可以從各個 /proc 文件中提取出硬件信息,比如:CPU、內存、usb 控制器、硬盤等。如果不帶選項的話,列出的信息將很長,加上 -short 選項時,將只列出概要信息。

[[email protected]_0_16_centos?~]$?sudo?lshw?-short
#篇幅關系,以下結果有刪減
H/W?path????????????Device??????Class??????????Description
==========================================================
????????????????????????????????system?????????Bochs
/0??????????????????????????????bus????????????Motherboard
/0/0????????????????????????????memory?????????96KiB?BIOS
/0/401??????????????????????????processor??????Intel(R)?Xeon(R)?CPU?E5-26xx?v4
/0/1000?????????????????????????memory?????????2GiB?System?Memory
/0/1000/0???????????????????????memory?????????2GiB?DIMM?RAM
/0/100??????????????????????????bridge?????????440FX?-?82441FX?PMC?[Natoma]
/0/100/1????????????????????????bridge?????????82371SB?PIIX3?ISA?[Natoma/Triton?II]
/0/100/1.1/0.1.0????/dev/cdrom??disk???????????QEMU?DVD-ROM
/0/100/1.2/1????????usb1????????bus????????????UHCI?Host?Controller
/0/100/1.3??????????????????????bridge?????????82371AB/EB/MB?PIIX4?ACPI
/0/100/4/0/1????????/dev/vda1???volume?????????49GiB?EXT3?volume
/0/100/5????????????????????????generic????????Virtio?memory?balloon
/0/100/5/0??????????????????????generic????????Virtual?I/O?device
/0/1????????????????????????????system?????????PnP?device?PNP0b00
/0/2????????????????????????????input??????????PnP?device?PNP0303

lscpu

lscpu 可以列出本機的 CPU 的相關信息,該命令沒有任何選項及參數。

[[email protected]_0_16_centos?~]$?lscpu
Architecture:??????????x86_64
CPU?op-mode(s):????????32-bit,?64-bit
Byte?Order:????????????Little?Endian
CPU(s):????????????????1
On-line?CPU(s)?list:???0
Thread(s)?per?core:????1
Core(s)?per?socket:????1
Socket(s):?????????????1
NUMA?node(s):??????????1
Vendor?ID:?????????????GenuineIntel
CPU?family:????????????6
Model:?????????????????79
Model?name:????????????Intel(R)?Xeon(R)?CPU?E5-26xx?v4
Stepping:??????????????1
CPU?MHz:???????????????2399.988
BogoMIPS:??????????????4799.97
Hypervisor?vendor:?????KVM
Virtualization?type:???full
L1d?cache:?????????????32K
L1i?cache:?????????????32K
L2?cache:??????????????4096K
NUMA?node0?CPU(s):?????0

lsusb

lsusb 列出與本機相連的所有 USB 設備的信息。默認情況下,只列出概要信息,使用 -v 選項可以列出每一個 USB 口的詳細信息。

[[email protected]_0_16_centos?~]$?lsusb
Bus?001?Device?003:?ID?0424:ec00?Standard?Microsystems?Corp.?SMSC9512/9514?Fast?Ethernet?Adapter
Bus?001?Device?002:?ID?0424:9514?Standard?Microsystems?Corp.?SMC9514?Hub
Bus?001?Device?001:?ID?1d6b:0002?Linux?Foundation?2.0?root?hub

lsscsi

lsscsi 可以列出諸如硬盤/光驅等 SCSI/SATA 設備信息。

[[email protected]_0_16_centos?~]$?lsscsi
[0:0:1:0]????cd/dvd??QEMU?????QEMU?DVD-ROM?????1.2.??/dev/sr0

lspci

lspci 列出所有 PCI 總線,以及與 PCI 總線相連的所有設備的詳細信息,比如 VGA 適配器、顯卡、網絡適配器、usb 端口、SATA 控制器等。

[[email protected]_0_16_centos?~]$?lspci
00:00.0?Host?bridge:?Intel?Corporation?440FX?-?82441FX?PMC?[Natoma]?(rev?02)
00:01.0?ISA?bridge:?Intel?Corporation?82371SB?PIIX3?ISA?[Natoma/Triton?II]
00:01.1?IDE?interface:?Intel?Corporation?82371SB?PIIX3?IDE?[Natoma/Triton?II]
00:01.2?USB?controller:?Intel?Corporation?82371SB?PIIX3?USB?[Natoma/Triton?II]?(rev?01)
00:01.3?Bridge:?Intel?Corporation?82371AB/EB/MB?PIIX4?ACPI?(rev?03)
00:02.0?VGA?compatible?controller:?Cirrus?Logic?GD?5446
00:03.0?Ethernet?controller:?Red?Hat,?Inc?Virtio?network?device
00:04.0?SCSI?storage?controller:?Red?Hat,?Inc?Virtio?block?device
00:05.0?Unclassified?device?[00ff]:?Red?Hat,?Inc?Virtio?memory?balloon

df

df 命令可以列出不同分區的大小,使用情況,使用率,掛載點等信息,加上 -h 選項可以以 k, M, G 等單位表示大小,否則默認是字節,不容易閱讀。

[[email protected]_0_16_centos?~]$?df?-h
Filesystem??????Size??Used?Avail?Use%?Mounted?on
/dev/vda1????????50G??7.5G???40G??16%?/
devtmpfs????????911M?????0??911M???0%?/dev
tmpfs???????????920M???68K??920M???1%?/dev/shm
tmpfs???????????920M??364K??920M???1%?/run
tmpfs???????????920M?????0??920M???0%?/sys/fs/cgroup
tmpfs???????????184M?????0??184M???0%?/run/user/0
tmpfs???????????184M?????0??184M???0%?/run/user/1001
tmpfs???????????184M?????0??184M???0%?/run/user/1000

free

free命令可以查看系統中使用的、閑置的和 RAM 的總體數量,一般帶上 -m 參數。

[[email protected]_0_16_centos?~]$?free?-m
??????????????total????????used????????free??????shared??buff/cache???available
Mem:???????????1839?????????221?????????156???????????0????????1461????????1400
Swap:?????????????0???????????0???????????0

網友評論comments

發表評論

電子郵件地址不會被公開。 必填項已用*標注

暫無評論

Copyright ? 2012-2019 YUNWEIPAI.COM - 運維派 - 粵ICP備14090526號-3
掃二維碼
掃二維碼
返回頂部
中国足彩网14选9