Overview
lshw is a tool that reports detailed physical hardware configuration of the system. To get the most information, it should be run with root privileges.
Key Features
- Provides detailed information on CPU, memory, disks, network, etc.
- Supports various output formats (HTML, XML, JSON)
- Can filter by specific hardware classes
- Requires root privileges (for maximum information)
Key Options
The lshw command offers several options to query and filter system hardware information in various ways.
Output Formats
Information Filtering
Other
Generated command:
Try combining the commands.
Description:
`lshw` Executes the command.
Combine the above options to virtually execute commands with AI.
Usage Examples
Various examples of querying system hardware information using the lshw command.
View All Hardware Information
sudo lshw
Displays detailed information about all hardware components of the system. Requires root privileges.
View Brief Hardware Summary
sudo lshw -short
Outputs a concise summary of hardware components.
View Only Network Interface Information
sudo lshw -class network
Filters and displays only network-related hardware information.
Save Disk Information in HTML Format
sudo lshw -class disk -html > hardware_disk.html
Outputs disk-related hardware information in HTML format and saves it to a file.
Output Memory Information in JSON Format
sudo lshw -class memory -json
Displays system memory information in JSON format.
Installation
lshw may not be included by default in most Linux distributions. You can install it using the following commands.
Debian/Ubuntu Based Systems
sudo apt update
sudo apt install lshw
Installs lshw using the APT package manager.
RHEL/CentOS/Fedora Based Systems
sudo yum install lshw # or dnf install lshw
Installs lshw using the YUM or DNF package manager.
Tips & Notes
Tips and points to note for more effective use of the lshw command.
Using Root Privileges
lshw queries deep hardware information of the system, so in most cases, you need to run it with root privileges using 'sudo' to see all information.
- Use `sudo lshw` to obtain maximum information.
- Limited information may be displayed for regular users.
Utilizing Output Formats
It supports various output formats such as HTML, XML, and JSON, so you can choose the appropriate format as needed for report generation or integration with other tools.
- Generate easily viewable reports in a web browser with `-html`.
- Obtain data that is easy to parse in scripts with `-json` or `-xml`.
Filtering Specific Hardware
The `-class` option allows you to quickly check information for a specific type of hardware. This saves time in finding the required information from complex full output.
- `-class network` (Network cards)
- `-class disk` (Storage devices)
- `-class memory` (Memory)
- `-class cpu` (CPU)