brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: systemctl list-unit-files with a state filter lists what systemd starts at boot

Systemd
~/tips/tip-systemd-list-unit-files-state

systemctl list-unit-files --state=enabled

Get a clean list of every enabled unit, or every masked or disabled one.

systemctl list-units shows what is loaded right now. To see what is switched on to start at boot, I’d look at the unit files instead.

Filter them on their enablement state:

systemctl list-unit-files --state=enabled
systemctl list-unit-files --state=masked,disabled --type=service

The first command gives a short table with columns UNIT FILE, STATE and PRESET, listing things like [email protected] and remote-fs.target. The preset column is handy on a fresh install: it tells you whether a unit is enabled because the distribution wants it or because someone turned it on.

It is worth running after setting up a new server, to spot services the installer enabled that nobody asked for, like a print service or a modem manager on a box that has neither.

A few states can surprise you. static units have no [Install] section and are only started by something else, so they never show as enabled. indirect means another unit pulls them in, and generated units come from fstab or similar files. To see what really runs, pair this with systemctl list-units --type=service --state=running.

Further reading: systemctl man page

More Systemd tips [Service] sudo mkdir -p /etc/systemd/system/service.d [Service] printf 'hunter2' | sudo systemd-creds encrypt --name=dbpass – dbpass.cred systemd-analyze timespan 1h30min All Systemd tips (88) All topics

Link