How to use the command 'hardinfo' (with examples)
- Linux
- November 5, 2023
The ‘hardinfo’ command is used to display hardware information in a graphical user interface (GUI) window. It is a useful tool for obtaining comprehensive information about various hardware components of a system.
Use case 1: Start ‘hardinfo’
Code:
hardinfo
Motivation: Starting the ‘hardinfo’ command without any arguments opens up the GUI window displaying the hardware information of the system. This can be useful when you want to quickly view the hardware details of your computer.
Explanation:
hardinfo
: This is the command to start the ‘hardinfo’ tool.
Example Output: The user interface of the ‘hardinfo’ tool will be displayed, showing various sections like computer, processor, memory, motherboard, storage, etc., along with their respective details.
Use case 2: Print report to ‘stdout’
Code:
hardinfo -r
Motivation: Printing the report to ‘stdout’ allows you to directly view the hardware information in the terminal without opening the GUI window. This can be helpful when you want to obtain the hardware information programmatically or need a quick overview of the system’s hardware.
Explanation:
hardinfo
: This is the command to start the ‘hardinfo’ tool.-r
: This argument tells ‘hardinfo’ to generate a report.
Example Output: The hardware information report will be printed in the terminal, displaying details about the computer, processor, memory, motherboard, storage, etc.
Use case 3: Save report to HTML file
Code:
hardinfo -r -f html > hardinfo.html
Motivation: Saving the hardware information report to an HTML file allows you to further analyze and share the report with others. The HTML format makes it easy to navigate through the information and provides a visual representation of the hardware details.
Explanation:
hardinfo
: This is the command to start the ‘hardinfo’ tool.-r
: This argument tells ‘hardinfo’ to generate a report.-f html
: This argument specifies the format of the report as HTML.> hardinfo.html
: This redirects the output of the command to a file named ‘hardinfo.html’.
Example Output: The hardware information report will be saved in an HTML file named ‘hardinfo.html’, which can be opened in a web browser to view the detailed information about the computer’s hardware components.
Conclusion:
The ‘hardinfo’ command is a versatile tool to gather, analyze, and share hardware information in both graphical and textual formats. Whether you need a quick overview of your system’s hardware or a detailed report for analysis, ‘hardinfo’ has you covered.