在 Debian(以及大多数使用 systemd 的 Linux 发行版)中,“定时器”通常指 systemd timer。你可以用以下几种方式列出所有定时器:
systemctl list-timers
常见输出示例:
NEXT LEFT LAST PASSED UNIT ACTIVATES
Mon 2026-01-19 00:00:00 CST 12h left Sun 2026-01-18 00:00:00 CST 11h ago apt-daily.timer apt-daily.service
只显示已启用的定时器:
systemctl list-timers --all
systemctl list-unit-files --type=timer
示例:
UNIT STATE
apt-daily.timer enabled
fstrim.timer enabled
systemctl status <timer名>
例如:
systemctl status apt-daily.timer
定时器通常会触发 .service:
systemctl list-timers --all --no-pager
如果你指的是 cron 定时任务,可以用:
crontab -l # 当前用户
sudo crontab -l # root 用户
ls /etc/cron.* # 系统级 cron
cat /etc/crontab
systemctl list-timerscrontab -l / /etc/cron.*如果你是想在脚本里解析定时器列表,也可以加 --output=json 或 --no-legend。需要我给你示例脚本吗?