Whether you're troubleshooting hardware issues, planning an upgrade, or just curious about your system’s specifications, Linux provides a variety of commands to gather comprehensive hardware information. Here are some essential commands:
1. Use lscpu to get detailed information about the CPU, including architecture, cores, threads, and CPU speeds.
# lscpu
2. The
lshw command provides a complete overview of hardware configuration, including CPU, memory, storage, and network. You’ll likely need superuser privileges to run it. # sudo lshw
3. For a clear overview of block devices, partitions, and mounted filesystems,
lsblk is a helpful command.# lsblk
4. The
dmidecode command extracts information from the system's DMI (Desktop Management Interface) table, displaying BIOS, processor, memory, and other hardware details. # sudo dmidecode
The
dmidecode command provides detailed information about your system's hardware components by reading the DMI (Desktop Management Interface) tables. Here's what you can typically view using dmidecode:# sudo dmidecode -t bios #BIOS Information
# sudo dmidecode -t system #System Information
# sudo dmidecode -t baseboard #Baseboard (Motherboard) Information
# sudo dmidecode -t processor #Processor Information
# sudo dmidecode -t memory #Memory Information
# sudo dmidecode -t cache #Cache Information
# sudo dmidecode -t chassis #Chassis Information
# sudo dmidecode -t connector #Connector and Port Information
# sudo dmidecode -t battery #Battery Information (for laptops).
5. To view information about PCI devices, such as graphics cards and network interfaces, use
lspci. # lspci
6. Use
lsusb to list details of all USB devices connected to the system, such as keyboards, mice, and external drives. # lsusb
7. The
free command shows memory usage details, while the -h option provides the output in a human-readable format. # free -h
8. To view filesystem disk space usage,
df with the -h flag will display disk usage in a readable format.# df -h
9. If you prefer a more visual output,
inxi provides a nice summary of CPU, graphics, audio, and network details. You might need to install it first:# sudo apt install inxi # For Debian/Ubuntu-based systems
# inxi -Fxz
IPMI (Intelligent Platform Management Interface) commands are used for managing and monitoring server hardware. These commands can be issued with the
ipmitool utility, which communicates with the BMC (Baseboard Management Controller) on the server. Below are some commonly used IPMI commands for various hardware management tasks:1. Get System Information:
Check BMC status:
# ipmitool chassis status
Show firmware versions:
# ipmitool mc info
Display all system information:
# ipmitool sdr list all
2. Power Management Commands:
Power on the server:
Power on the server:
# ipmitool chassis power on
Power off the server:
# ipmitool chassis power off
Power cycle (reboot) the server:
# ipmitool chassis power cycle
Check current power status:
# ipmitool chassis power status
3. Monitor Hardware Health:
Get sensor readings (temperature, fan speed, etc.):
Get sensor readings (temperature, fan speed, etc.):
# ipmitool sensor list
Check individual sensor data:# ipmitool sensor get <sensor_name>
Display all sensor data in real-time:
# watch ipmitool sensor
4. View Event Log:
Show event log entries:
Show event log entries:
# ipmitool sel list
Clear the event log:
# ipmitool sel clear
Show the last N entries from the log:
# ipmitool sel list | tail -n <N>
5. Network Configuration for BMC:
Show the BMC network configuration:
Show the BMC network configuration:
# ipmitool lan print 1
Set a static IP for the BMC:
6. User Management:
# ipmitool lan set 1 ipsrc static
# ipmitool lan set 1 ipaddr <IP_ADDRESS>
# ipmitool lan set 1 netmask <NETMASK>
# ipmitool lan set 1 defgw ipaddr <GATEWAY>
6. User Management:
List existing IPMI users:
# ipmitool user list 1
Add a new user:
# ipmitool user set name <user_id> <username>
# ipmitool user set password <user_id> <password>
# ipmitool user enable <user_id>
Set user privileges: # ipmitool user priv <user_id> <privilege_level> 1
7. Remote Console Access (SOL):
Enable SOL (Serial Over LAN):
# ipmitool sol activate
Deactivate SOL session:
# ipmitool sol deactivate
8. FRU Information (Field Replaceable Units):
Display FRU (Field Replaceable Unit) details:
Display FRU (Field Replaceable Unit) details:
# ipmitool fru
9. Network configuration details for the BMC:
To display network configuration details for the BMC (Baseboard Management Controller) on a server:
To display network configuration details for the BMC (Baseboard Management Controller) on a server:
# ipmitool lan print
These commands will help you manage and monitor your servers, providing important information on their health and status. If you don’t have
ipmitool installed, you can usually install it with the following: # On CentOS/RHEL
# sudo yum install -y ipmitool
# On Ubuntu/Debian
# sudo apt-get install -y ipmitool
Each of these commands provides specific insights into the various components of your system. Combining them will give you a comprehensive understanding of your Linux hardware setup!
Comments
Post a Comment