Systemd 服务与日志排查

systemctljournalctl 通常需要配合使用:前者查看和管理服务状态,后者查看服务日志。

查看某个服务状态


systemctl status nginx

systemctl status docker

重启服务与重新加载配置


systemctl restart nginx

systemctl daemon-reload

列出系统服务


systemctl list-units --type=service

查看某个服务日志


journalctl -u nginx

journalctl -u docker -f

查看最近启动日志


journalctl -b

journalctl -b -1

按时间筛选日志


journalctl --since "2025-10-01 00:00:00"