system-admin
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseLinux 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
undefinedbash
undefinedSystem 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
undefineduptime
undefinedHardware Information
硬件信息
bash
undefinedbash
undefinedCPU 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
undefinedlsblk
df -h
undefinedResource Monitoring
资源监控
Real-time Monitoring
实时监控
bash
undefinedbash
undefinedComprehensive 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
undefinediftop
nethogs
undefinedHistorical Data
历史数据
bash
undefinedbash
undefinedSystem activity report
System activity report
sar -u 1 10 # CPU
sar -r 1 10 # Memory
sar -d 1 10 # Disk
undefinedsar -u 1 10 # CPU
sar -r 1 10 # Memory
sar -d 1 10 # Disk
undefinedService Management
服务管理
Systemd Services
Systemd服务
bash
undefinedbash
undefinedService 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
undefinedsystemctl list-units --type=service
undefinedCommon Scenarios
常见场景
Scenario 1: System Health Check
场景1:系统健康检查
bash
undefinedbash
undefinedQuick 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
undefinedecho "=== System Load ===" && uptime
echo "=== Memory Usage ===" && free -h
echo "=== Disk Usage ===" && df -h
echo "=== Failed Services ===" && systemctl --failed
undefinedScenario 2: Troubleshoot High Load
场景2:高负载排查
bash
undefinedbash
undefined1. 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
undefinedps aux --sort=-%mem | head -10
undefinedTroubleshooting
故障排查
| Problem | Commands |
|---|---|
| System lag | |
| Disk full | |
| Memory shortage | |
| Service abnormal | |
| 问题 | 命令 |
|---|---|
| 系统卡顿 | |
| 磁盘已满 | |
| 内存不足 | |
| 服务异常 | |