Linux System Information Commands
Overview
Linux provides a range of commands to gather information about the system's hardware, software, and overall status. These commands are useful for monitoring and troubleshooting system performance and configuration. This document covers basic and commonly used system information commands.
System Information
uname
Displays system information.
Example
uname -a
Displays all available system information, including kernel version and system architecture.
Example
uname -a
# Output: Linux hostname 5.4.0-42-generic #46-Ubuntu SMP Fri Sep 25 13:00:00 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
hostname
Displays or sets the system's hostname.
Example
hostnamectl
Displays or changes the system's hostname and other system information.
Example
hostnamectl
# Output: Provides detailed information about the system's hostname, operating system, and hardware
Hardware Information
lscpu
Displays detailed information about the CPU architecture.
Example
lscpu
# Output: Displays CPU architecture information including number of CPUs, model name, and more
lsblk
Lists information about all available block devices.
Example
lspci
Lists all PCI devices on the system.
Example
lsusb
Lists all USB devices connected to the system.
Example
dmidecode
Displays information about the system's hardware as described in the BIOS.
Example
sudo dmidecode
# Output: Provides detailed information about hardware components, such as memory, CPU, and motherboard
Memory and Disk Usage
free
Displays information about system memory usage.
Example
df
Displays information about disk space usage for mounted filesystems.
Example
du
Displays disk usage of files and directories.
Example
top
Displays real-time system performance and process information.
Example
top
# Output: Displays a real-time, interactive view of system processes and resource usage
# Use 'q' to quit
htop
An enhanced version of top
with a more user-friendly interface.
Example
htop
# Output: Provides an interactive, user-friendly view of system processes and resource usage
# Use 'q' to quit
System Uptime
uptime
Displays how long the system has been running, along with the number of users and load average.
Example
Summary
Linux provides a variety of commands to gather detailed system information, from hardware details and disk usage to real-time performance metrics. Understanding these commands helps in monitoring and maintaining system health. For more detailed information on each command, refer to the Linux manual pages.