Команды Linux для получения расширенной информации об оборудовании и системе

Команды Linux для получения расширенной информации об оборудовании и системе
Команды Linux для получения расширенной информации об оборудовании и системе

Иногда вам нужно получить информацию об оборудовании. Возможно, вы провели обновление, и эта информация больше не является точной. Приведенные ниже команды также будут полезны для отладки оборудования.

Системный администратор

Uname — Linux kernel info

uname -a — kernel version
uname -m — system architecture

lspci — list of all attached devices to PCI bus

lspci -vvv — enable verbose mode.

# lspci
00:00.0 Host bridge: Intel Corporation 5500 I/O Hub to ESI Port (rev 13)
00:01.0 PCI bridge: Intel Corporation 5520/5500/X58 I/O Hub PCI Express Root Port 1 (rev 13)
00:09.0 PCI bridge: Intel Corporation 7500/5520/5500/X58 I/O Hub PCI Express Root Port 9 (rev 13)

lshw — complete all in one list of installed hardware components

lshw works without sudo, but provides much less info. Includes memory configuration, firmware revisions, CPU info and core frequencies. --sanitize flag is super useful when you want to upload result to the internet, it will hide IP addresses and serial numbers, --shortflag is good for compact output.
Report in HTML is very helpful for easy sharing: $ sudo lshw –html > report.html

hwinfo — another tool, very similar to lshw

Hwinfo, created by SUSE developers, is another general purpose hardware probing utility capable off reporting detailed and brief information about multiple different hardware components.

$ hwinfo
$ hwinfo –short

dmidecode -extract info from BIOS/UEFI using SMBIOS API.

--type option for device-related info like bios,system,chassis


$ sudo dmidecode -t processor
$ sudo dmidecode -t memory

lsusb — perfect command to show all pluggable devices

Useful flags: -vvv for verbose mode, -s [bus]:[devnum] will show only specific device on you need to watch. You can easily sort by vendor with -d [vendor]:[product], view all in three modes with -t and use device-file config with -S /dev/X option.

$ lsusb
Bus 005 Device 002: ID 045e:00cb Microsoft Corp. Basic Optical Mouse v2.0
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

lscpu — first command to get CPU info

Verbose mode can be enabled with -e flag, -p also very useful for better formatting. --online and --offline can be specified for better visualization.

lsscsi — print attacked SCSI devices into

«Old bud gold» SCSI drives used mostly in enterprise, more costly than PCI & SATA devices. Verbose mode can be enabled with -L, -l and -v options.

$ lsscsi
[3:0:0:0] disk ATA ST3500418AS CC38 /dev/sda
[4:0:0:0] cd/dvd SONY DVD RW DRU-190A 1.63 /dev/sr0

dmesg — kernel logs

Kernel logs are very helpful for hardware events like attach, detach, shutdown etc. Works much better with grep and less commands: sudo dmesg | grep -i audio | less.

inxi — «all in one» script

The crazy, bigger than 10k lines of code, bash script, capable to fetch multiple system APIs and provide gigantic pile of info. Useful flags: -z to hide sensitive info if you wanna upload reports to internet, -F for verbose mode, -A for audio information, -m — memory, — -i — networking, -p — disk info, all options you can check in help menu which can be invoked by -H.

fdisk, gdisk and parted — all about your drive partitions

Why are there three commands here, you want to ask? Well, they are doing very similar jobs and completely independent projects. gdisk was a fdisk fork with GTP partitioning mode support; now fdisk supports GPT too. Covering their options will take several posts like this, but here’s how to check your drive info: $ fdisk -l or gdisk -l or parted -l.

blkid and lsblk — block devices list

These commands shows info about available block devices. Examples below:

$ lsblk -a
sda 8:0 0 232.9G 0 disk
├─sda1 8:1 0 200M 0 part
# blkid -i /dev/sda

mount — mount a drive and print info about already mounted

$ mount | column -t for better visualization, sudo mount /dev/sdaN /media/data — mount a partition.

$ mount | column -t
/dev/sda2   on  /                                type  ext4        (rw,relatime,stripe=256)
devtmpfs    on  /dev                             type  devtmpfs    (rw,nosuid,noexec,relatime,size=5827492k,nr_inodes=1456873,mode=755,inode64)

df — check used and free disk space

Useful flag: df -H — human-readable output.

/prop/cpuinfo — CPU specs
/proc/version — kernel version
/proc/partitions — partitions info

hdparm — get/set SATA/IDE device parameters

Available by default in most of Linux distribution for many years, very useful for advanced configuration.

$ hdparm -g — display drive geometry

$ hdparm -tT /dev/sdN — partition reading & writing benchmark