lshw
Overview
The lshw (List Hardware) command provides detailed information about the physical hardware configuration of the machine. It can report exact memory configuration, firmware version, mainboard configuration, CPU version and speed, cache configuration, bus speed, etc.
Syntax
lshw [options]Common Options
| Option | Description |
|---|---|
-short |
Brief output |
-businfo |
Bus information |
-class class |
Show specific class |
-C class |
Same as -class |
-html |
HTML output |
-xml |
XML output |
-json |
JSON output |
-sanitize |
Hide sensitive info |
-numeric |
Numeric IDs |
-quiet |
Less verbose |
-version |
Show version |
Hardware Classes
| Class | Description |
|---|---|
system |
System info |
cpu |
Processor |
memory |
Memory devices |
disk |
Storage |
network |
Network interfaces |
display |
Display adapters |
multimedia |
Multimedia devices |
power |
Power device |
input |
Input devices |
Key Use Cases
- Hardware inventory
- System diagnostics
- Configuration check
- Troubleshooting
- Documentation
Examples with Explanations
Example 1: Basic Usage
lshw -shortBrief hardware list
Example 2: Specific Class
lshw -class diskShow storage devices
Example 3: HTML Output
lshw -html > hardware.htmlGenerate HTML report
Common Usage Patterns
Full system scan:
lshwNetwork devices:
lshw -class networkMemory info:
lshw -class memory
Security Considerations
- Sensitive information
- System access
- Output sanitization
- Report distribution
- Access control
Additional Resources
Best Practices
- Regular scanning
- Documentation
- Change tracking
- Report formatting
- Data protection
Output Formats
- Text (default)
- HTML
- XML
- JSON
- Short format
Troubleshooting
- Missing information
- Access errors
- Output format
- Device detection
- System compatibility