- 16 Commands to Check Hardware Information on Linux
- Hardware information
- 1. lscpu
- 2. lshw — List Hardware
- 3. hwinfo — Hardware Information
- 4. lspci — List PCI
- 5. lsscsi — List scsi devices
- 6. lsusb — List usb buses and device details
- 7. Inxi
- 8. lsblk — List block devices
- 9. df — disk space of file systems
- 10. Pydf — Python df
- 11. fdisk
- 12. mount
- 13. free — Check RAM
- 14. dmidecode
- 15. /proc files
- 16. hdparm
- Summary
- 48 thoughts on “ 16 Commands to Check Hardware Information on Linux ”
- How To Find Hard Disk Drive Details In Linux
- 1. Hdparm
- 1.1. Install hdparm on Linux
- 1.2. Find Hard Disk Drive details in Linux using Hdparm
- 2. lshw
- 2.1. Install lshw in Linux
- 2.2. Find Hard Disk Drive Details In Linux Using lshw
- 3. inxi
- 3.1. Install inxi in Linux
- 3.2. Find Hard Disk Drive Details In Linux Using Inxi
- 4. Smartctl
- 4.1. Find Hard Disk Drive Details In Linux Using Smartctl
- 5. Find Hard Disk Drive Details In Linux Using Lsblk
- 6. Find Hard Disk Drive Details In Linux Using Fdisk and Sfdisk Commands
- 7. Find Hard Disk Drive Details In Linux Using /proc
- 8. Hwinfo
- 8.1. Install Hwinfo In Linux
- 8.2. Find Hard Disk Drive Details In Linux Using Hwinfo
- 9. GNOME Disks
- 9.1. Find Hard Disk Drive Details In Linux Using GNOME Disks
16 Commands to Check Hardware Information on Linux
Hardware information
Like for every thing, there are plenty of commands to check information about the hardware of your linux system.
Some commands report only specific hardware components like cpu or memory while the rest cover multiple hardware units.
This post takes a quick look at some of the most commonly used commands to check information and configuration details about various hardware peripherals and devices.
The list includes lscpu, hwinfo, lshw, dmidecode, lspci etc.
1. lscpu
The lscpu command reports information about the cpu and processing units. It does not have any further options or functionality.
2. lshw — List Hardware
A general purpose utility, that reports detailed and brief information about multiple different hardware units such as cpu, memory, disk, usb controllers, network adapters etc. Lshw extracts the information from different /proc files.
Check out the following post to learn more about lshw
3. hwinfo — Hardware Information
Hwinfo is another general purpose hardware probing utility that can report detailed and brief information about multiple different hardware components, and more than what lshw can report.
4. lspci — List PCI
The lspci command lists out all the pci buses and details about the devices connected to them.
The vga adapter, graphics card, network adapter, usb ports, sata controllers, etc all fall under this category.
Filter out specific device information with grep.
5. lsscsi — List scsi devices
Lists out the scsi/sata devices like hard drives and optical drives.
6. lsusb — List usb buses and device details
This command shows the USB controllers and details about devices connected to them. By default brief information is printed. Use the verbose option «-v» to print detailed information about each usb port
On the above system, 1 usb port is being used by the mouse.
7. Inxi
Inxi is a 10K line mega bash script that fetches hardware details from multiple different sources and commands on the system, and generates a beautiful looking report that non technical users can read easily.
8. lsblk — List block devices
List out information all block devices, which are the hard drive partitions and other storage devices like optical drives and flash drives
9. df — disk space of file systems
Reports various partitions, their mount points and the used and available space on each.
10. Pydf — Python df
An improved df version written in python, that displays colored output that looks better than df
11. fdisk
Fdisk is a utility to modify partitions on hard drives, and can be used to list out the partition information as well.
12. mount
The mount is used to mount/unmount and view mounted file systems.
Again, use grep to filter out only those file systems that you want to see
13. free — Check RAM
Check the amount of used, free and total amount of RAM on system with the free command.
14. dmidecode
The dmidecode command is different from all other commands. It extracts hardware information by reading data from the SMBOIS data structures (also called DMI tables).
Check out the man page for more details.
15. /proc files
Many of the virtual files in the /proc directory contain information about hardware and configurations. Here are some of them
16. hdparm
The hdparm command gets information about sata devices like hard disks.
Summary
Each of the command has a slightly different method of extracting information, and you may need to try more than one of them, while looking for specific hardware details. However they are available across most linux distros, and can be easily installed from the default repositories.
On the desktop there are gui tools, for those who do not want to memorise and type commands. Hardinfo, I-nex are some of the popular ones that provide detailed information about multiple different hardware components.
A Tech Enthusiast, Blogger, Linux Fan and a Software Developer. Writes about Computer hardware, Linux and Open Source software and coding in Python, Php and Javascript. He can be reached at [email protected] .
48 thoughts on “ 16 Commands to Check Hardware Information on Linux ”
How i can check memory in CPU. Example OPT, Efuse
Thanks for this. I’m just getting going on a VPS and this helped me discover they’d not given me the extra 1Gb I ordered. Very well explained.
Super happy with
inxi -Fx
more accurate than some of the other utilities.. for instance hwinfo was inaccurate for my Lenovo
Thanks for the great post!
Thank you! Your descriptions were useful and well explained!
Источник
How To Find Hard Disk Drive Details In Linux
This guide lists various methods to find Hard disk drive details in Linux operating systems. Using the below methods, you can able to find the hard disk make, hard disk type, size, firmware version, partition tables and other hardware parameters. First, we will see how to display hard disk details with hdparm command line utility.
1. Hdparm
Hdparm is a command line program to get or set hardware parameters for PATA, SATA, SAS and SSD devices.
It accepts any device as mass storage that is connected to IDE, SATA, SAS interfaces, so we can even retrieve information about CD/DVD drives as well.
Using hdparm utility, we can tune the hard disk or DVD drive, test the HDD or SSD speed, reduce noise level by activating acoustic mode, turn energy-saving mode on or off, enable or disable sleep mode, enable/disable drive cache and even erase drives securely.
Hdparm is written by Mark Lord, the lead developer and maintainer of the (E)IDE driver for Linux, and current contributor to the «libata» subsystem.
A word of caution
Even though hdparm offers significant advantages to increase disk performance, it is also EXTREMELY DANGEROUS . It will very likely lead to massive data loss when some parameters are misused. The hdparm documentation suggests that YOU SHOULD NOT USE SOME COMMANDS AT ANY CIRCUMSTANCES . So I’ve excluded such dangerous commands in this guide. More importantly, It is always recommended to backup your hard drive before testing hdparm on your Linux system.
1.1. Install hdparm on Linux
Hdparm comes pre-installed in most Linux distributions. If it is not included for any reason, install hdparm on your Linux system using the default package manager.
On Arch Linux, Manjaro Linux:
On Debian, Ubuntu, Linux Mint:
On Fedora, CentOS, RHEL:
1.2. Find Hard Disk Drive details in Linux using Hdparm
To display detailed information of the hard disk, simply run hdparm with sudo or root privileges as shown below:
Here, sda is my hard disk. Replace it with your own device. Here I have used «less» command for interactive reading. Press ENTER key or hit UP/DOWN arrows to go through the rest of the output. Press q to exit when done.
Sample output from my Ubuntu system:
As you can see, the hdparm displays the hard disk’s model number, serial number, firmware revision followed by hard disk configuration (no of cylinders, heads, sectors), DMA settings, list of enabled features, security parameters etc. All functions found under «Commands/features» section and marked with an asterisk are currently active.
Similarly, you can check information of other devices.
When running hdparm with no options, -acdgkmur is assumed. Refer man pages to know what each option is for.
For more details, refer man pages.
2. lshw
Lshw (Hardware Lister) is a simple, yet full-featured utility that provides detailed information on the hardware configuration of a Linux system. It can report exact memory configuration, firmware version, mainboard configuration, CPU version and speed, Hard disk drive details, cache configuration, bus speed and a lot more.
2.1. Install lshw in Linux
lshw comes pre-installed with some Linux distributions like Ubuntu by default. If it is not installed by any chance, install lshw in your Linux box using the default package manager like below.
On Arch Linux and its variants like Manjaro Linux, run:
On Debian, Ubuntu, Linux Mint:
On Fedora, CentOS, RHEL:
2.2. Find Hard Disk Drive Details In Linux Using lshw
After installing lshw, simply run the following command to get the details of your hard disk drive in Linux:
Sample output:
To display only the name of the disks, run:
Sample output:
For more details, check man pages.
3. inxi
Inxi is yet another full-featured command line system information tool. It shows system hardware, CPU, drivers, Xorg, Desktop, Kernel, GCC version(s), Processes, RAM usage, and a wide variety of other useful information. Be it a hard disk or CPU, mother board or the complete detail of the entire system, inxi will get them for you more accurately in seconds.
3.1. Install inxi in Linux
Inxi is also available in the default repositories of most Linux distributions.
For Arch Linux, it is available in AUR. You can install it using any AUR helper programs, for example Yay.
On Debian, Uubntu:
On CentOS and RHEL:
Enable [EPEL] repository using the following command:
3.2. Find Hard Disk Drive Details In Linux Using Inxi
To get the details of the installed hard disk drives in your Linux system, run:
Sample output:
You can also display more disk details like disk controller speed, serial no and temperature using the following command:
Sample output:
Unlike Hdparm and lshw programs, it will only display the hard disk drive details. The hdparm and lshw utilities will display all drive details including CD/DVD ROM.
For more details, refer man pages.
Suggested read:
4. Smartctl
Smartclt is a command line, control and monitor utility for SMART disks. It controls the Self-Monitoring, Analysis and Reporting Technology (shortly SMART) system built into most ATA/SATA and SCSI/SAS hard drives and solid-state drives. Smartclt command is part of the smartmontools package, which comes pre-installed in most Linux versions.
4.1. Find Hard Disk Drive Details In Linux Using Smartctl
To fetch the complete details about the hard disk drive in your Linux box, run:
Sample output:
For more details, refer man pages.
5. Find Hard Disk Drive Details In Linux Using Lsblk
Lsblk is a command line utility to display all available or the specified block devices in Unix-like operating systems. It reads the «sysfs» filesystem and «udev db» to gather information. The lsblk command is part of the «util-linux» package, which comes pre-installed in most Linux distributions.
To display all block devices using lsblk command, run:
Sample output:
You can even display more details including filesystem type, UUID, Mountpoint etc., like below:
Sample output:
If you want to display only the physical devices, use «-d» flag.
6. Find Hard Disk Drive Details In Linux Using Fdisk and Sfdisk Commands
Fdisk and Sfdisk commands are used to create and manipulate partition tables. fdisk is a dialog-driven program for creating and manipulating partition tables whereas sfdisk is a script-oriented tool for partitioning any block device. Both are part of util-linux package which comes pre-installed in all Linux distros.
To get the HDD details, run fdisk as root or sudo user with «-l» flag:
Sample output:
The usage of Sfdisk is same as fdisk. To list HDD details using Sfdisk, run it with -l flag with root or sudo privileges:
To exclude the details of dm (device mapper) devices from the output, run:
Sample output:
7. Find Hard Disk Drive Details In Linux Using /proc
The /proc is a special virtual filesystem in Unix-like distributions. It is also known as process information pseudo-file system. It doesn’t contain any ‘real’ files but runtime system information such as processes, system memory, mounted devices and hardware configuration etc. Each device details are stored in a separate directory under /proc directory. The storage devices’ details will be available in «/proc/scsi/scsi» file.
Sample output:
8. Hwinfo
Hwinfo is a free, open source and command line utility to find Linux system hardware information. It probes for the hardware present in a Linux system and displays the extensive details of each hardware device. It uses libhd.so library to gather details of almost all hardware such as BIOS, CPU, Architecture, Memory, Hard Disk(s), Partitions, Camera, Bluetooth, CD/DVD drives, Keyboard/Mouse, Graphics card, Monitor, Modem, Scanner, Printer, PCI, IDE, SCSI, Sound card, Network interface card, USB and a lot more.
8.1. Install Hwinfo In Linux
Refer the following link to install Hwinfo in your Linux system.
8.2. Find Hard Disk Drive Details In Linux Using Hwinfo
To find Hard disk drive details using Hwinfo, run:
Sample output:
Or you can display the short summary of the disk details:
Sample output:
9. GNOME Disks
Disks or Gnome-disk-utility is a graphical user interface program to view, modify and configure available storage devices and media in a Linux system. If you are not comfortable with command line way, you can use use GNOME Disks to create and restore disk images, partition and format drives, inspect drive speed, benchmark drives and check health status etc. It comes pre-installed in all Linux distributions that has GNOME desktop environment.
9.1. Find Hard Disk Drive Details In Linux Using GNOME Disks
Launch Disks either from Menu or Dash. It lists all available disks and media in your Linux system.
Источник