systemctllist-units# all active unitssystemctllist-units--type=service# services onlysystemctllist-units--state=failed# failed unitssystemctllist-unit-files--type=service# all installed services + statesystemctlcat<service># show unit filesystemctlshow<service># all properties (machine-readable)systemctlshow-pRestart,ExecStart<service>
# Dependenciessystemctllist-dependencies<service>
systemctllist-dependencies--reverse<service># who depends on it
journalctl-u<service># logs for a servicejournalctl-u<service>-f# followjournalctl-u<service>-n50# last 50 linesjournalctl-u<service>--since"1h ago"journalctl-u<service>--since"2024-01-01"--until"2024-01-02"journalctl-b# current bootjournalctl-b-1# previous bootjournalctl--list-boots
journalctl-perr# errors and abovejournalctl-perr-unginx
journalctl--disk-usage
journalctl--vacuum-time=7d# keep only last 7 daysjournalctl--vacuum-size=500M
Unit files
Unit files live in:
/lib/systemd/system/ — installed by packages (don't edit)
/etc/systemd/system/ — local overrides and custom units ✅
# /etc/systemd/system/cleanup.timer[Unit]Description=Run cleanup daily[Timer]OnCalendar=dailyPersistent=true# run missed jobs after reboot[Install]WantedBy=timers.target
systemctlpoweroff
systemctlreboot
systemctlsuspendsystemctlhibernate
# Targets (runlevels)systemctlget-default# current default targetsystemctlset-defaultmulti-user.target# no GUI on next bootsystemctlisolaterescue.target# switch to rescue mode now
# Overview of what failedsystemctl--failed
# Why did it fail?systemctlstatus<service>
journalctl-u<service>-n50--no-pager
# Common fix: unit file edited → reload daemonsystemctldaemon-reload&&systemctlrestart<service>