systemctl cat myunit.service
prints the contents of the main myunit.service
file followed by any override files. Is there a way to print the unit file that systemd will actually use, i.e. the one formed from merging the overrides into the main unit?
- 145
- 5
1 Answers
You can use systemctl show myunit.service
to display properties of the unit.
It will print all properties associated with that unit file, global configuration and any customizations made in unit file(s).
By default, empty properties are suppressed. Use --all to show those too.
systemctl show myunit.service --all
If you want to check a given property, use the following synthax:
systemctl show myunit.service --property=<PROPERTY_NAME>
#example
#systemctl show myunit.service --property=ExecStart
Note that the output may be not exactly what you expect:
Note that the properties shown by the command are generally more low-level, normalized versions of the original configuration settings and expose runtime state in addition to configuration. For example, properties shown for service units include the service's current main process identifier as "MainPID" (which is runtime state), and time settings are always exposed as properties ending in the "...USec" suffix even if a matching configuration options end in "...Sec", because microseconds is the normalized time unit used internally by the system and service manager.
For details about many of these properties, see the documentation of the D-Bus interface backing these properties, see org.freedesktop.systemd1(5).
- 232
- 2
- 8
-
That worked - thanks a lot! Is there a way to hide settings that are their default values? – Sean Jan 29 '22 at 11:56
-
1@Sean Unfortunately I don't think so. I just discovered that command and man page doesn't show an option for that. The only thing I see is to set explicitly all properties you want to check `systemctl show myunit.service --property=PROPERTY1,PROPERTY2,PROPERTY3` . – Chris Jan 29 '22 at 12:05