Linux 查看硬件信息的命令
- hwinfo
- lshw
- lscpu
- lspci
- lsscsi
- lsblk
- df
- fdisk
- free
- dmidecode
lshw -short
lshw -shortH/W path Device Class Description================================================== system Standard PC (i440FX + PIIX, 1996)/0 bus Motherboard/0/0 memory 96KiB BIOS/0/400 processor Virtual CPU 714389bda930/0/1000 memory 512MiB System Memory/0/1000/0 memory 512MiB DIMM RAM/0/100 bridge 440FX - 82441FX PMC [Natoma]/0/100/1 bridge 82371SB PIIX3 ISA [Natoma/Triton II]/0/100/1.1 storage 82371SB PIIX3 IDE [Natoma/Triton II]/0/100/1.2 bus 82371SB PIIX3 USB [Natoma/Triton II]/0/100/1.2/1 usb1 bus UHCI Host Controller/0/100/1.2/1/1 input QEMU USB Tablet/0/100/1.3 bridge 82371AB/EB/MB PIIX4 ACPI/0/100/2 display GD 5446/0/100/3 network Virtio network device/0/100/3/0 ens3 network Ethernet interface/0/100/4 storage Virtio block device/0/100/4/0 /dev/vda disk 21GB Virtual I/O device/0/100/4/0/1 /dev/vda1 volume 19GiB EXT4 volume/0/100/5 generic Virtio memory balloon/0/100/5/0 generic Virtual I/O device/0/100/6 generic Virtio RNG/0/100/6/0 generic Virtual I/O device/0/1 scsi1 storage/0/1/0.0.0 /dev/cdrom disk QEMU DVD-ROM |
hwinfo --short
hwinfo --shortcpu: Virtual CPU 714389bda930, 2400 MHzkeyboard: /dev/input/event1 AT Translated Set 2 keyboardmouse: /dev/input/mice Adomax QEMU USB Tablet /dev/input/mice VirtualPS/2 VMware VMMouse /dev/input/mice VirtualPS/2 VMware VMMousegraphics card: Red Hat QEMU Virtual Machinestorage: Floppy disk controller Red Hat Qemu virtual machine Virtio Storage 0network: ens3 Virtio Ethernet Card 0network interface: ens3 Ethernet network interface lo Loopback network interfacedisk: /dev/vda Diskpartition: /dev/vda1 Partitioncdrom: /dev/sr0 QEMU DVD-ROMusb controller: Red Hat QEMU Virtual Machinebios: BIOSbridge: Red Hat Qemu virtual machine Red Hat Qemu virtual machine Red Hat Qemu virtual machinehub: Linux Foundation 1.1 root hubmemory: Main Memoryunknown: FPU DMA controller PIC Keyboard controller PS/2 Controller Red Hat Virtio network device Red Hat Virtio RNG Red Hat Virtio memory balloon Red Hat Virtio block device Virtio Unclassified device Virtio Unclassified device |
lscpu
lscpuArchitecture: x86_64CPU op-mode(s): 32-bit, 64-bitByte Order: Little EndianCPU(s): 1On-line CPU(s) list: 0Thread(s) per core: 1Core(s) per socket: 1Socket(s): 1NUMA node(s): 1Vendor ID: GenuineIntelCPU family: 6Model: 60Model name: Virtual CPU 714389bda930Stepping: 1CPU MHz: 2399.996BogoMIPS: 4799.99Hypervisor vendor: KVMVirtualization type: fullL1d cache: 32KL1i cache: 32KL2 cache: 4096KL3 cache: 16384KNUMA node0 CPU(s): 0Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx rdtscp lm constant_tsc rep_good nopl xtopology cpuid pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm invpcid_single pti fsgsbase bmi1 avx2 smep bmi2 erms invpcid xsaveopt arat |
lspci
lspci00: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 544600:03.0 Ethernet controller: Red Hat, Inc Virtio network device00:04.0 SCSI storage controller: Red Hat, Inc Virtio block device00:05.0 Unclassified device [00ff]: Red Hat, Inc Virtio memory balloon00:06.0 Unclassified device [00ff]: Red Hat, Inc Virtio RNG |
lsscsi
lsscsi[1:0:0:0] cd/dvd QEMU QEMU DVD-ROM 2.5+ /dev/sr0 |
lsblk
lsblkNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTsr0 11:0 1 1024M 0 romvda 252:0 0 20G 0 disk└─vda1 252:1 0 20G 0 part / |
df -H
df -HFilesystem Size Used Avail Use% Mounted onudev 222M 0 222M 0% /devtmpfs 51M 1.9M 49M 4% /run/dev/vda1 22G 7.7G 13G 39% /tmpfs 253M 0 253M 0% /dev/shmtmpfs 5.3M 0 5.3M 0% /run/locktmpfs 253M 0 253M 0% /sys/fs/cgrouptmpfs 51M 0 51M 0% /run/user/1000tmpfs 51M 0 51M 0% /run/user/0 |
fdisk -l
fdisk -lDisk /dev/vda: 20 GiB, 21474836480 bytes, 41943040 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisklabel type: dosDisk identifier: 0x28892bb4Device Boot Start End Sectors Size Id Type/dev/vda1 * 2048 41942917 41940870 20G 83 Linux |
free -m
free -m total used free shared buff/cache availableMem: 481 208 84 1 188 252Swap: 0 0 0 |
dmidecode
dmidecode -t processor# dmidecode 3.1Getting SMBIOS data from sysfs.SMBIOS 2.8 present.Handle 0x0400, DMI type 4, 42 bytesProcessor Information Socket Designation: CPU 0 Type: Central Processor Family: Other Manufacturer: QEMU ID: C1 06 03 00 FF FB 8B 07 Version: pc-i440fx-2.11 Voltage: Unknown External Clock: Unknown Max Speed: 2000 MHz Current Speed: 2000 MHz Status: Populated, Enabled Upgrade: Other L1 Cache Handle: Not Provided L2 Cache Handle: Not Provided L3 Cache Handle: Not Provided Serial Number: Not Specified Asset Tag: Not Specified Part Number: Not Specified Core Count: 1 Core Enabled: 1 Thread Count: 1 Characteristics: None |
dmidecode -t memory# dmidecode 3.1Getting SMBIOS data from sysfs.SMBIOS 2.8 present.Handle 0x1000, DMI type 16, 23 bytesPhysical Memory Array Location: Other Use: System Memory Error Correction Type: Multi-bit ECC Maximum Capacity: 512 MB Error Information Handle: Not Provided Number Of Devices: 1Handle 0x1100, DMI type 17, 40 bytesMemory Device Array Handle: 0x1000 Error Information Handle: Not Provided Total Width: Unknown Data Width: Unknown Size: 512 MB Form Factor: DIMM Set: None Locator: DIMM 0 Bank Locator: Not Specified Type: RAM Type Detail: Other Speed: Unknown Manufacturer: QEMU Serial Number: Not Specified Asset Tag: Not Specified Part Number: Not Specified Rank: Unknown Configured Clock Speed: Unknown Minimum Voltage: Unknown Maximum Voltage: Unknown Configured Voltage: Unknown |
dmidecode -t bios# dmidecode 3.1Getting SMBIOS data from sysfs.SMBIOS 2.8 present.Handle 0x0000, DMI type 0, 24 bytesBIOS Information Vendor: SeaBIOS Version: rel-1.11.0-0-g63451fca13-prebuilt.qemu-project.org Release Date: 04/01/2014 Address: 0xE8000 Runtime Size: 96 kB ROM Size: 64 kB Characteristics: BIOS characteristics not supported Targeted content distribution is supported BIOS Revision: 0.0 |
cat /proc/*info
cat /proc/cpuinfoprocessor : 0vendor_id : GenuineIntelcpu family : 6model : 60model name : Virtual CPU 714389bda930stepping : 1microcode : 0x1cpu MHz : 2399.996cache size : 16384 KBphysical id : 0siblings : 1core id : 0cpu cores : 1apicid : 0initial apicid : 0fpu : yesfpu_exception : yescpuid level : 13wp : yesflags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx rdtscp lm constant_tsc rep_good nopl xtopology cpuid pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm invpcid_single pti fsgsbase bmi1 avx2 smep bmi2 erms invpcid xsaveopt aratbugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypassbogomips : 4799.99clflush size : 64cache_alignment : 64address sizes : 40 bits physical, 48 bits virtualpower management: |
cat /proc/meminfoMemTotal: 492952 kBMemFree: 80048 kBMemAvailable: 258908 kBBuffers: 13988 kBCached: 153836 kBSwapCached: 0 kBActive: 284324 kBInactive: 30576 kBActive(anon): 155100 kBInactive(anon): 148 kBActive(file): 129224 kBInactive(file): 30428 kBUnevictable: 12164 kBMlocked: 12164 kBSwapTotal: 0 kBSwapFree: 0 kBDirty: 12 kBWriteback: 0 kBAnonPages: 159260 kBMapped: 31708 kBShmem: 1860 kBSlab: 57180 kBSReclaimable: 31344 kBSUnreclaim: 25836 kBKernelStack: 2176 kBPageTables: 6564 kBNFS_Unstable: 0 kBBounce: 0 kBWritebackTmp: 0 kBCommitLimit: 246476 kBCommitted_AS: 606604 kBVmallocTotal: 34359738367 kBVmallocUsed: 0 kBVmallocChunk: 0 kBHardwareCorrupted: 0 kBAnonHugePages: 0 kBShmemHugePages: 0 kBShmemPmdMapped: 0 kBCmaTotal: 0 kBCmaFree: 0 kBHugePages_Total: 0HugePages_Free: 0HugePages_Rsvd: 0HugePages_Surp: 0Hugepagesize: 2048 kBDirectMap4k: 229232 kBDirectMap2M: 294912 kB |
cat /proc/versionLinux version 4.15.0-22-generic (buildd@lgw01-amd64-013) (gcc version 7.3.0 (Ubuntu 7.3.0-16ubuntu3)) #24-Ubuntu SMP Wed May 16 12:15:17 UTC 2018 |
cat /proc/scsi/scsiAttached devices:Host: scsi1 Channel: 00 Id: 00 Lun: 00 Vendor: QEMU Model: QEMU DVD-ROM Rev: 2.5+ Type: CD-ROM ANSI SCSI revision: 05 |
cat /proc/partitionsmajor minor #blocks name 11 0 1048575 sr0 252 0 20971520 vda 252 1 20970435 vda1 |