system-admin

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Linux System Administration

Linux系统管理

Overview

概述

Core commands and best practices for Linux system administration, including system information viewing, resource monitoring, service management, etc.
Linux系统管理的核心命令与最佳实践,包括系统信息查看、资源监控、服务管理等。

System Information

系统信息

Basic Information

基本信息

bash
undefined
bash
undefined

System version

System version

cat /etc/os-release uname -a
cat /etc/os-release uname -a

Hostname

Hostname

hostnamectl
hostnamectl

Uptime and load

Uptime and load

uptime
undefined
uptime
undefined

Hardware Information

硬件信息

bash
undefined
bash
undefined

CPU information

CPU information

lscpu cat /proc/cpuinfo
lscpu cat /proc/cpuinfo

Memory information

Memory information

free -h cat /proc/meminfo
free -h cat /proc/meminfo

Disk information

Disk information

lsblk df -h
undefined
lsblk df -h
undefined

Resource Monitoring

资源监控

Real-time Monitoring

实时监控

bash
undefined
bash
undefined

Comprehensive monitoring

Comprehensive monitoring

top htop
top htop

Memory monitoring

Memory monitoring

vmstat 1
vmstat 1

IO monitoring

IO monitoring

iostat -x 1 iotop
iostat -x 1 iotop

Network monitoring

Network monitoring

iftop nethogs
undefined
iftop nethogs
undefined

Historical Data

历史数据

bash
undefined
bash
undefined

System activity report

System activity report

sar -u 1 10 # CPU sar -r 1 10 # Memory sar -d 1 10 # Disk
undefined
sar -u 1 10 # CPU sar -r 1 10 # Memory sar -d 1 10 # Disk
undefined

Service Management

服务管理

Systemd Services

Systemd服务

bash
undefined
bash
undefined

Service status

Service status

systemctl status service-name systemctl is-active service-name
systemctl status service-name systemctl is-active service-name

Start/Stop services

Start/Stop services

systemctl start/stop/restart service-name
systemctl start/stop/restart service-name

Boot startup

Boot startup

systemctl enable/disable service-name
systemctl enable/disable service-name

View all services

View all services

systemctl list-units --type=service
undefined
systemctl list-units --type=service
undefined

Common Scenarios

常见场景

Scenario 1: System Health Check

场景1:系统健康检查

bash
undefined
bash
undefined

Quick health check script

Quick health check script

echo "=== System Load ===" && uptime echo "=== Memory Usage ===" && free -h echo "=== Disk Usage ===" && df -h echo "=== Failed Services ===" && systemctl --failed
undefined
echo "=== System Load ===" && uptime echo "=== Memory Usage ===" && free -h echo "=== Disk Usage ===" && df -h echo "=== Failed Services ===" && systemctl --failed
undefined

Scenario 2: Troubleshoot High Load

场景2:高负载排查

bash
undefined
bash
undefined

1. Check load

1. Check load

uptime
uptime

2. Find high CPU processes

2. Find high CPU processes

ps aux --sort=-%cpu | head -10
ps aux --sort=-%cpu | head -10

3. Find high memory processes

3. Find high memory processes

ps aux --sort=-%mem | head -10
undefined
ps aux --sort=-%mem | head -10
undefined

Troubleshooting

故障排查

ProblemCommands
System lag
top
,
vmstat 1
,
iostat -x 1
Disk full
df -h
,
du -sh /*
,
ncdu
Memory shortage
free -h
,
ps aux --sort=-%mem
Service abnormal
systemctl status
,
journalctl -u
问题命令
系统卡顿
top
,
vmstat 1
,
iostat -x 1
磁盘已满
df -h
,
du -sh /*
,
ncdu
内存不足
free -h
,
ps aux --sort=-%mem
服务异常
systemctl status
,
journalctl -u