Yesterday's Linux DFIR command line trivia asked how you could get a list of services that are configured to start at boot time and how to get a list of services which exist on the system but which are not configured to start at boot.
I'm going to give the win to @lamitpObuS for correcting my original (incorrect) solution:
systemctl list-units --state=[active|inactive]
Actually "--state=active" is the default if you run "systemctl list-units".
Note that by default "list-units" shows everything, including items like the file system mounting targets and network configuration, etc. If you really just want to see the normal Linux background services that are configured on the box, add the "--type" option:
systemctl list-units --type=service
That will get you a list of the active background services.
systemctl list-units --type=service --state=inactive
Will get you the ones that are not running.
Note that you can also run:
systemctl list-units --all
This will give you one listing showing not only active and disabled unit files, but even items that have not yet been installed.
#Linux #DFIR #CommandLine #Trivia