Back to commands

Linux Survival Basics

Read-only

Map systemd Timers to Services

systemctl list-timers shows timer units, but you need to see what service each timer activates.

Command

systemctl list-timers --all --no-pager --plain | awk 'NR==1 || /\.timer/ {print $(NF-1), "->", $NF}'

Before you run this

System impact: Read-only. Low when scoped to the shown target.

When not to use it: Do not use it to inspect the service definition itself; follow up with systemctl cat on the unit.

Expected output

Mappings such as backup.timer -> backup.service.

System impact

Read-only. Nothing changes. The command condenses timer rows into timer-to-service mappings.

Recovery / rollback: no state is changed.

When to use it

Use when auditing scheduled work on modern Linux systems that may not rely only on cron.

When not to use it

Do not use it to inspect the service definition itself; follow up with systemctl cat on the unit.

Watch this command run

Command transcript

This sanitized transcript shows the commands and output shape without exposing host details.

demo@lab:~$

$ systemctl list-timers --all --no-pager --plain

NEXT                         LEFT     LAST                         PASSED UNIT                 ACTIVATES
Thu 2026-06-25 22:00:00 CDT  7h left  Thu 2026-06-25 02:00:00 CDT  12h ago backup.timer         backup.service
Fri 2026-06-26 00:05:00 CDT  9h left  Thu 2026-06-25 00:05:00 CDT  14h ago certbot.timer        certbot.service
Thu 2026-06-25 23:50:00 CDT  8h left  Thu 2026-06-25 00:00:10 CDT  14h ago logrotate.timer      logrotate.service
n/a                          n/a      Mon 2026-06-22 01:00:00 CDT  3 days ago stale-report.timer stale-report.service
4 timers listed.

$ systemctl list-timers --all --no-pager --plain | awk 'NR==1 || /\.timer/ {print $(NF-1), "->", $NF}'

UNIT -> ACTIVATES
backup.timer -> backup.service
certbot.timer -> certbot.service
logrotate.timer -> logrotate.service
stale-report.timer -> stale-report.service
View commands shown

These are the commands shown in the sanitized transcript.

Commands shown

  1. systemctl list-timers --all --no-pager --plain
  2. systemctl list-timers --all --no-pager --plain | awk 'NR==1 || /\.timer/ {print $(NF-1), "->", $NF}'

next steps

Related commands

Hosting Operations Read-only

Spot Stale systemd Timers

The suspicious timer is the one with no next run.

systemctl list-timers --all --no-pager --plain | awk 'NR==1 || $1=="n/a" || /backup\.timer|logrotate\.timer/'
Linux Survival Basics Read-only

List Upcoming systemd Timers

Cron is not the only scheduler on modern Linux servers.

systemctl list-timers --all --no-pager
Linux Survival Basics Read-only

Show Failed systemd Units

One command tells you which services systemd already knows are broken.

systemctl --failed --no-pager
Linux Survival Basics Read-only

Show Context Around the First App Error

The first error often explains more than the last one.

awk '{buf[NR%5]=$0} tolower($0) ~ /(error|exception|fatal)/ {for (i=NR-4;i<=NR;i++) if (i>0) print buf[i%5]; exit}' fixtures/incidents/app.log
Linux Survival Basics Read-only

Print the Exact systemd Exit Fields

Turn a noisy service failure into four fields you can paste into an incident note.

systemctl show app-worker --property=Result,ExecMainCode,ExecMainStatus,NRestarts --no-pager
Study mapping

Use this as independent command practice: read the notes, predict the output, then compare it with the example before using a real shell.

  • lpic1:101-system-architecture
  • lpic1:103-gnu-unix-commands
  • lpic1:107-admin-tasks
  • lpic1:108-essential-services
  • lfcs:essential-commands
  • lfcs:operations-deployment
  • lfcs:services-logs
  • linuxplus:automation-scripting
  • linuxplus:provisional
  • linuxplus:services-users
  • linuxplus:troubleshooting
  • risk:read-only

Useful for

  • LPIC-1 style command-line practice
  • LFCS style performance tasks
  • Linux+ style troubleshooting review

Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.