Linux 教程(7):Linux 系统管理系列

本章概述

本篇介绍 Linux 系统管理的核心知识。

进程管理

查看进程

ps aux          # 查看所有进程
top             # 实时查看进程
htop            # 增强版 top
pgrep nginx     # 查找特定进程

控制进程

kill PID        # 终止进程
kill -9 PID     # 强制终止
killall name    # 按名称终止
pkill pattern   # 按模式终止

服务管理

systemctl 命令

systemctl start service    # 启动服务
systemctl stop service     # 停止服务
systemctl restart service  # 重启服务
systemctl status service   # 查看状态
systemctl enable service   # 开机自启
systemctl disable service  # 禁用自启

磁盘管理

查看磁盘

df -h         # 查看磁盘使用
du -sh *      # 查看目录大小
lsblk         # 查看块设备
fdisk -l      # 查看分区

挂载操作

mount /dev/sdb1 /mnt      # 挂载
umount /mnt               # 卸载
mount -a                  # 挂载所有

网络管理

网络配置

ip addr show              # 查看 IP
ip route show             # 查看路由
ss -tulpn                 # 查看端口
netstat -tulpn            # 查看网络连接

日志管理

journalctl -u service     # 查看服务日志
tail -f /var/log/syslog   # 实时查看日志
dmesg                     # 查看内核日志

性能监控

uptime                    # 查看运行时间
free -h                   # 查看内存
iostat                    # 查看 IO
vmstat                    # 查看虚拟内存

系统管理是 Linux 运维的核心技能!

发表回复

后才能评论