How to check information about hardware in linux
Table of contents:
- How to verify information about hardware in Linux
- Lscpu command - Processing
- lshw - Linux hardware list
- lsusb - List of usb buses and device details
- Inxi
- lsblk - Block Device List
- df - disk space of file systems
- Pydf - Python df
- fdisk
- mount
- free - Check RAM
- Files in the / proc directory
- CPU / memory information
- Linux / kernel information
- Sata / SCSI Devices
- Partitions
- hdparm - Hard Drive Information
- Summary
As with everything, there are many commands to verify information about hardware in Linux. Some commands report only specific hardware components like CPU or memory, while the rest cover multiple hardware units. In this post, take a quick look at how to check hardware information on Linux. The list includes commands like lscpu, hwinfo, lshw, lspci, among others.
Index of contents
How to verify information about hardware in Linux
Lscpu command - Processing
The lscpu command reports on the CPU and processing units, one of the most important parts of hardware in Linux. The command has no further options or functionality.
lscpu
The output will be:
Architecture: x86_64 CPU op-mode (s): 32-bit, 64-bit Byte order: Little Endian CPU (s): 4 List of online CPU (s): 0-3 Thread (s) per core: 1 Core (s) Per Socket: 4 Socket (s): 1 Node (s) NUMA: 1 Vendor ID: GenuineIntel CPU Family: 6 Model: 23 Stepping: 10 CPU MHz: 1998, 000 BogoMIPS: 5302.48 Virtualization: VT-x Cache L1d: 32K Cache L1i: 32K Cache L2: 2048K NUMA node0 CPU (s): 0-3
lshw - Linux hardware list
This general purpose utility gives us brief and detailed information about multiple Linux hardware units, such as CPU, memory, disk, usb drivers, network adapters, etc. Lshw extracts the information from different / proc files.
sudo lshw -short
When executing it in console we will be able to see the following:
H / W path Device Class Description =========================================== ======== system () / 0 bus DG35EC / 0/0 processor Intel (R) Core (TM) 2 Quad CPU Q8400 @ 2.66GHz / 0/0/1 memory 2MiB L2 cache / 0/0 / 3 memory 32KiB L1 cache / 0/2 memory 32KiB L1 cache / 0/4 memory 64KiB BIOS / 0/14 memory 8GiB System Memory / 0/14/0 memory 2GiB DIMM DDR2 Synchronous 667 MHz (1.5 ns) / 0/14 / 1 memory 2GiB DIMM DDR2 Synchronous 667 MHz (1.5 ns) / 0/14/2 memory 2GiB DIMM DDR2 Synchronous 667 MHz (1.5 ns) / 0/14/3 memory 2GiB DIMM DDR2 Synchronous 667 MHz (1.5 ns) / 0/100 bridge 82G35 Express DRAM Controller / 0/100/2 display 82G35 Express Integrated Graphics Controller /0/100/2.1 display 82G35 Express Integrated Graphics Controller / 0/100/19 eth0 network 82566DC Gigabit Network Connection / 0/100 / 1a bus 82801H (ICH8 Family) USB UHCI Controller # 4 /0/100/1a. 1 bus 82801H (ICH8 Family) USB UHCI Controller # 5 /0/100/1a. 7 bus 82801H (ICH8 Family) USB2 EHCI Controller # 2/0/100 / 1b multimedia 82801H (ICH8 Family) HD Audi o Controller / 0/100 / 1c bridge 82801H (ICH8 Family) PCI Express Port 1 /0/100/1c.1 bridge 82801H (ICH8 Family) PCI Express Port 2 /0/100/1c.2 bridge 82801H (ICH8 Family) PCI Express Port 3 /0/100/1c.2/0 storage JMB368 IDE controller / 0/100 / 1d bus 82801H (ICH8 Family) USB UHCI Controller # 1 /0/100/1d.1 bus 82801H (ICH8 Family) USB UHCI Controller # 2 /0/100/1d.2 bus 82801H (ICH8 Family) USB UHCI Controller # 3 /0/100/1d.7 bus 82801H (ICH8 Family) USB2 EHCI Controller # 1/0/100 / 1e bridge 82801 PCI Bridge / 0/100 / 1e / 5 bus FW322 / 323 1394a Controller / 0/100 / 1f bridge 82801HB / HR (ICH8 / R) LPC Interface Controller /0/100/1f.2 storage 82801H (ICH8 Family) 4 port SATA Controller /0/100/1f.3 bus 82801H (ICH8 Family) SMBus Controller /0/100/1f.5 storage 82801HR / HO / HH (ICH8R / DO / DH) 2 port SATA Controller disk ATA ST3500418AS CC38 / dev / sda cd / dvd SONY DVD RW DRU-190A 1.63 / dev / sr0
lsusb - List of usb buses and device details
This command displays the USB drivers and details about the devices connected to them. By default, brief information is printed. If we want the detailed option we use the argument "-v" to print more explicit information about each usb port.
lsusb Bus 002 Device 001: ID 1d6b: 0002 Linux Foundation 2.0 root hub Bus 007 Device 001: ID 1d6b: 0001 Linux Foundation 1.1 root hub Bus 006 Device 001: ID 1d6b: 0001 Linux Foundation 1.1 root hub 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 Bus 001 Device 001: ID 1d6b: 0002 Linux Foundation 2.0 root hub Bus 004 Device 001: ID 1d6b: 0001 Linux Foundation 1.1 root hub Bus 003 Device 001: ID 1d6b: 0001 Linux Foundation 1.1 root hub
Inxi
Inxi is a 10K line mega bash script that gets hardware details from multiple sources and different commands on the system, and generates a beautiful report that non-technical users can easily read.
lsblk - Block Device List
List the information of all block devices, which are hard drive partitions and other storage devices like optical drives and flash memory drives.
We execute in the terminal:
lsblk
We get in response:
NAME MAJ: MIN RM SIZE RO TYPE MOUNTPOINT sda 8: 0 0 465.8G 0 disk ├─sda1 8: 1 0 70G 0 part ├─sda2 8: 2 0 1K 0 part ├─sda5 8: 5 0 97.7G 0 part / medium / 4668484A68483B47 dasda6 8: 6 0 97.7G 0 part / ├─sda7 8: 7 0 1.9G 0 part └─sda8 8: 8 0 198.5G 0 part / average / 13f35f59-f023-4d98-b06f-9dfaebefd6c1 sr0 11: 0 1 1024M 0 rom
df - disk space of file systems
Reports various partitions, their mount points, and the space used and available on each.
df -H
class = "terminal" & Filesystem Size Used Avail Use% Mounted on / dev / sda6 104G 26G 73G 26% / none 4.1k 0 4.1k 0% / sys / fs / cgroup udev 4.2G 4.1k 4.2G 1% / dev tmpfs 837M 1.6M 835M 1% / run none 5.3M 0 5.3M 0% / run / lock none 4.2G 13M 4.2G 1% / run / shm none 105M 21k 105M 1% / run / user / dev / sda8 210G 149G 51G 75% / media / 13f35f59-f023-4d98-b06f-9dfaebefd6c1 / dev / sda5 105G 31G 75G 30% / media / 4668484A68483B47
Pydf - Python df
This utility is an improved version of df written in python, which shows a colored output and makes it look better than df.
pydf Filesystem Size Used Avail Use% Mounted on / dev / sda6 96G 23G 68G 24.4 / / dev / sda8 195G 138G 47G 70.6 / media / 13f35f59-f023-4d98-b06f-9dfaebefd6c1 / dev / sda5 98G 28G 69G 29.2 / media / 4668484A
fdisk
Fdisk is a utility for modifying partitions on hard drives, and can also be used to list partition information.
sudo fdisk -l
If you want to know more about this command you can read: Linux Commands for Hard Disk and partition management.
mount
The mount command is used to mount / unmount and view mounted file systems.
mount | column -t / dev / sda6 on / type ext4 (rw, errors = remount-ro) proc on / proc type proc (rw, noexec, nosuid, nodev) sysfs on / sys type sysfs (rw, noexec, nosuid, nodev) none on / sys / fs / cgroup type tmpfs (rw) none on / sys / fs / fuse / connections type fusectl (rw) none on / sys / kernel / debug type debugfs (rw) none on / sys / kernel / security type securityfs (rw) udev on / dev type devtmpfs (rw, mode = 0755) devpts on / dev / pts type devpts (rw, noexec, nosuid, gid = 5, mode = 0620) tmpfs on / run type tmpfs (rw, noexec, nosuid, size = 10%, mode = 0755) none on / run / lock type tmpfs (rw, noexec, nosuid, nodev, size = 5242880) none on / run / shm type tmpfs (rw, nosuid, nodev) none on / run / user type tmpfs (rw, noexec, nosuid, nodev, size = 104857600, mode = 0755) none on / sys / fs / pstore type pstore (rw) / dev / sda8 on / media / 13f35f59-f023-4d98- b06f-9dfaebefd6c1 type ext4 (rw, nosuid, nodev, errors = remount-ro) / dev / sda5 on / media / 4668484A68483B47 type fuseblk (rw, nosuid, nodev, allow_other, blksize = 4096) binfmt_misc on / proc / sys / / binfmt_misc type binfmt_misc (rw, noexec, nosuid, nodev) systemd on / sys / fs / cgroup / systemd type cgroup (rw, noexec, nosuid, nodev, none, name = systemd) gvfsd-fuse on / run / user / 1000 / gvfs type fuse.gvfsd -fuse (rw, nosuid, nodev, user = enlightened)
free - Check RAM
Verify the amount of used, free, and total RAM in the system with the free command.
Files in the / proc directory
Many of the virtual files in the / proc directory contain information about Linux hardware and settings. Here are some of them:
CPU / memory information
# cpu information cat / proc / cpuinfo # memory information cat / proc / meminfo
Linux / kernel information
cat / proc / version Linux version 3.11.0-12-generic (buildd @ allspice) (gcc version 4.8.1 (Ubuntu / Linaro 4.8.1-10ubuntu7)) # 19-Ubuntu SMP Wed Mar 25 16:20:46 UTC 2018
Sata / SCSI Devices
$ cat / proc / scsi / scsi Attached devices: Host: scsi3 Channel: 00 Id: 00 Mon: 00 Vendor: ATA Model: ST3500418AS Rev: CC38 Type: Direct-Access ANSI SCSI revision: 05 Host: scsi4 Channel: 00 Id: 00 Mon: 00 Vendor: SONY Model: DVD RW DRU-190A Rev: 1.63 Type: CD-ROM ANSI SCSI revision: 05
Partitions
cat / proc / partitions major minor #blocks name 8 0 488386584 sda 8 1 73400953 sda1 8 2 1 sda2 8 5 102406311 sda5 8 6 102406311 sda6 8 7 1998848 sda7 8 8 208171008 sda8 11 0 1048575 sr0
hdparm - Hard Drive Information
Finally, we have the hdparm command, it works to get information about sata devices like hard drives.
sudo hdparm -i / dev / sda / dev / sda: Model = ST3500418AS, FwRev = CC38, SerialNo = 9VMJXV1N Config = {HardSect NotMFM HdSw> 15uSec Fixed DTR> 10Mbs RotSpdTol>.5%} RawCHS = 16383/16/63, TrkSize = 0, SectSize = 0, ECCbytes = 4 BuffType = unknown, BuffSize = 16384kB, MaxMultSect = 16, MultSect = 16 CurCHS = 16383/16/63, CurSects = 16514064, LBA = yes, LBAsects = 976773168 IORDY = on / off, tPIO = {min: 120, w / IORDY: 120}, tDMA = {min: 120, rec: 120} PIO modes: pio0 pio1 pio2 pio3 pio4 DMA modes: mdma0 mdma1 mdma2 UDMA modes: udma0 udma1 udma3 udma4 * udma5 * udma6 AdvancedPM = no WriteCache = enabled Drive conforms to: unknown: ATA / ATAPI-4, 5, 6, 7 * means the current active mode
Summary
As you might notice, each of the commands has a slightly different method of extracting information, and we may need to use more than one of them to search for specific hardware details in Linux. However, they are available in most Linux distributions and can be easily installed from the default repositories.
Have you used any of the commands? Tell us in the comments, which ones have you used and to obtain what information? Do not forget to share if you found our guide useful?
The oneplus 3t will improve hardware for only 40/80 € more: all the information
Technical characteristics of the new OnePlus 3T where aspects such as the processor, the battery, the camera and the option of 128 GB of memory have been improved.
How to check if your hard drive is failing on linux
We teach you to use the linux fsck commands to force the hard disk check quickly. It is very important to know the state of your disk.
Mixed reality pc check, check if you are ready for mixed reality
Microsoft launches Windows Mixed Reality PC Check, a free tool with which we will be able to know if our team is prepared for mixed reality.