The hwinfo “hardware information” is used to find any hardware information. Using this tool, we can easily get the hardware information for the whole system or any specific hardware device. It provides information like CPU, USB controllers, Disks, etc. Using this command, we can also save the specific hardware information in a text file which can be used for sharing purposes.
This write-up illustrates the usage of the “hwinfo” command in Linux. The content for this post is as follows:
- What is hwinfo Command in Linux?
- How Does hwinfo Command Work?
- How to Use hwinfo Command in Linux?
- Bonus Tip: Save the Hardware Data in the File
Let’s get started.
What is the hwinfo Command in Linux?
The “hwinfo” is a free and open-source tool to display the hardware information of any device. This tool comes with the built-in installation of Linux. However, if it is not installed in your system, the following commands can be used to install it:
For Debian/Ubuntu-based distributions:
$ sudo apt install hwinfo
For CentOS/RHEL:
$ sudo yum install hwinfo
For Fedora Linux:
$ sudo dnf install hwinfo
For Arch and Manjaro Linux:
$ sudo pacman -s hwinfo
Let’s have a look at the working of the “hwinfo” command.
How Does hwinfo Command Work?
The “hwinfo” command works for getting the whole hardware information, or this command can also be used for getting specific hardware information like CPU, Network, Disks, etc. It can also be used to generate a log overview of the information. Below is the list of options for which “hwinfo” commands work.
Hardware | Purpose |
---|---|
CPU | To retrieve the CPU information |
Disks | To get the information about disks |
Keyboard | To get the keyboard information |
Mouse | To get the mouse information |
Sound | To get the sound card information |
Bios | To get the bios information |
Chipcard | To get the chipcard information |
Bluetooth | To get the Bluetooth information |
Network | To get the network information |
Disks Partition | To get information about disks partitions |
WLAN | To get the wifi information |
How to Use hwinfo Command in Linux?
There are various ways to use the “hwinfo” command in Linux, which are explained in the below examples.
Example 1: To Get Whole Hardware information
The following “hwinfo” command has retrieved all the hardware information of my system. Users can use any of the two commands. Both commands will display the same results:
$ sudo hwinfo
$ sudo hwinfo --all
The above screenshots show all the information on the hardware.
Example 2: To Retrieve the CPU Information
The “hwinfo” can be used to retrieve the information of the specific hardware component as well. For instance, you can retrieve the information of the CPU via the following command:
$ sudo hwinfo --cpu
By executing the above command, the CPU information is displayed as shown in the above image.
Example 3: To Get the Disks Information
Similarly, to get the information about the disks, you can use the below-mentioned command in the terminal:
$ sudo hwinfo --disks
Above image represents the information about the disks.
Example 4: To Retrieve the Network Information
Using the “hwinfo” command, the network information can be obtained as follows:
$ sudo hwinfo --network
The network information can be seen in the above image:
Example 5: To Get the Partition Information
The “hwinfo” command can be used to display the disk partition information. Execute the given command:
$ sudo hwinfo --partition
Disk partition information can be seen in the above image.
Example 6: To Get the Short Hardware Information
To display the overview, the log information of hardware can be retrieved using the “hwinfo” command:
$ sudo hwinfo --short
The above images show the overview log information of the hardware.
Example 7: To Get the BIOS Information
Using the “hwinfo” command, BIOS information is obtained as follows:
$ sudo hwinfo --bios
By executing the above command, BIOS information has been displayed, as shown in the above image.
Example 8: To Get the Sound Card Information
Using the “hwinfo” command, the sound card information is obtained as follows:
$ sudo hwinfo --sound
By running the above command, the information about the sound card is displayed in the above image.
Bonus Tip: Save the Hardware Data in the File
One More feature of the “hwinfo” command allows the users to put up any hardware information in a text file that can be shared with other persons. The implementation of this command is given below:
$ hwinfo --all --log hardwareinfo.txt
All the information will be exported in a file, as shown in the above image. This command can also be used to get the specific hardware information in a file:
For example, the following commands will save the information of network and keyboard respectively:
$ hwinfo --network --log networkinfo.txt
$ hwinfo --keyboard --log Keyboardinfo.txt
Moreover, the output file can be restricted to read-only permissions by running the above command with “sudo” (as a root user):
$ sudo hwinfo --all --log hardwareinformation.txt
After entering the password, the file will be created as shown in the below image:
For more details, information and its usage, you may get it from the following command:
$ hwinfo --help
That’s it from this guide.
Conclusion
In Linux, the “hwinfo” command is used to get the whole and specific hardware information. It can also be used to get any hardware information in a file. In this article, multiple usages of the “hwinfo” command have been demonstrated with the help of examples. Apart from that, a method to get hardware information in a text file has also been illustrated.