Essential Linux System Information Commands

Introduction

Understanding your Linux system's hardware, kernel, and configuration is essential for troubleshooting, optimization, and documentation. This guide covers 10 essential commands for gathering comprehensive system information.

1. uname - System Information

Display kernel and system information.

# Show kernel name
uname -s

# Show kernel version
uname -r

# Show machine hardware
uname -m

# Show operating system
uname -o

# Show all information
uname -a

# Example output:
# Linux hostname 5.15.0-91-generic x86_64 GNU/Linux

Options: -s=kernel name, -r=kernel release, -m=machine, -o=OS, -a=all

2. hostname - System Hostname

Display or set the system hostname.

# Show current hostname
hostname

# Show short hostname
hostname -s

# Show fully qualified domain name
hostname -f

# Show IP address
hostname -I

# Set hostname permanently
sudo hostnamectl set-hostname newhostname

# Show hostnamectl info
hostnamectl status

3. lscpu - CPU Information

Display detailed CPU architecture information.

# Show all CPU info
lscpu

# Show CPU cores
lscpu | grep -E "^CPU\(s\):"

# Show thread count
lscpu | grep Thread

# Show model name
lscpu | grep "Model name"

# Show cache info
lscpu | grep -i cache

# Output in JSON format
lscpu -J

# Output in parseable format
lscpu -p

4. free - Memory Usage

Display physical and swap memory usage.

# Show memory usage
free

# Show in human-readable format
free -h

# Show in megabytes
free -m

# Show total column
free -t

# Continuous monitoring (1 second)
free -h -s 1

Understanding: total, used, free, shared, buff/cache, available

5. top/htop - System Monitor

Display real-time system and process information.

# Start top
top

# Show specific user
top -u username

# Sort by CPU (press P in top)
top

# Sort by memory (press M in top)
top

# Start htop (if installed)
htop

# htop with specific user
htop -u username

Key Metrics: Load average, CPU usage, Memory usage, Swap usage

6. uptime - System Uptime

Show how long system has been running.

# Show uptime
uptime

# Show only uptime
uptime -p

# Show since boot time
uptime -s

# Show short format
uptime -r

7. dmidecode - Hardware Information

Display hardware components from DMI table.

# Show all hardware info
sudo dmidecode

# Show BIOS info
sudo dmidecode -t bios

# Show system info
sudo dmidecode -t system

# Show motherboard info
sudo dmidecode -t baseboard

# Show processor info
sudo dmidecode -t processor

# Show memory info
sudo dmidecode -t memory

8. lspci - PCI Devices

List PCI devices and hardware components.

# List all PCI devices
lspci

# Verbose output
lspci -v

# Very verbose
lspci -vv

# Show numeric IDs
lspci -nn

# Show kernel drivers
lspci -k

# Show device tree
lspci -t

# Show specific device
lspci | grep -i vga
lspci | grep -i audio

9. lsusb - USB Devices

List USB devices connected to system.

# List all USB devices
lsusb

# Verbose output
lsusb -v

# Show device tree
lsusb -t

# Show specific bus
lsusb -b 1

10. inxi - System Information Tool

Comprehensive system information display.

# Install inxi
sudo apt install inxi

# Show full system info
inxi -F

# Show CPU info
inxi -C

# Show memory info
inxi -m

# Show disk info
inxi -D

# Show network info
inxi -N

# Show sensors (temp, fans)
inxi -s

Quick Reference Table

CommandPurposeExample
unameKernel infouname -a
hostnameSystem namehostname -f
lscpuCPU detailslscpu
freeMemory usagefree -h
top/htopSystem monitortop
uptimeSystem uptimeuptime -p
dmidecodeHardware infodmidecode -t system
lspciPCI deviceslspci -v
lsusbUSB deviceslsusb -v
inxiFull system infoinxi -F

Conclusion

These 10 system information commands enable you to identify hardware components, monitor system resources, troubleshoot performance issues, document system configuration, and verify system specifications.


Related Articles:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值