Linux "systemd" Command Line Options and Examples
systemd system and service manager

systemd is a system and service manager for Linux operating systems. When run as first process on boot (as PID 1), it acts as init system that brings up and maintains userspace services. For compatibility with SysV, if systemd is called as init and a PID that is not 1, it will execute telinit and pass all command line arguments unmodified.


Usage:

/lib/systemd/systemd [OPTIONS...]


    init [OPTIONS...] {COMMAND}






Command Line Options:

--test
Determine startup sequence, dump it and exit. This is an option useful for debugging only.
systemd --test ...
--dump-configuration-items
Dump understood unit configuration items. This outputs a terse but complete list of configuration itemsunderstood in unit definition files.
systemd --dump-configuration-items ...
--unit
Set default unit to activate on startup. If not specified, defaults to default.target.
systemd --unit ...
--system
For --system, tell systemd to run a system instance, even if the process ID is not 1, i.e. systemd is notrun as init process. --user does the opposite, running a user instance even if the process ID is 1.Normally, it should not be necessary to pass these options, as systemd automatically detects the mode itis started in. These options are hence of little use except for debugging. Note that it is not supportedbooting and maintaining a full system with systemd running in --system mode, but PID not 1. In practice,passing --system explicitly is only useful in conjunction with --test.
systemd --system ...
--dump-core
Enable core dumping on crash. This switch has no effect when running as user instance. This setting mayalso be enabled during boot on the kernel command line via the systemd.dump_core= option, see below.
systemd --dump-core ...
--crash-vt
Switch to a specific virtual console (VT) on crash. Takes a positive integer in the range 1–63, or aboolean argument. If an integer is passed, selects which VT to switch to. If yes, the VT kernel messagesare written to is selected. If no, no VT switch is attempted. This switch has no effect when running asuser instance. This setting may also be enabled during boot, on the kernel command line via thesystemd.crash_vt= option, see below.
systemd --crash-vt ...
--crash-shell
Run a shell on crash. This switch has no effect when running as user instance. This setting may also beenabled during boot, on the kernel command line via the systemd.crash_shell= option, see below.
systemd --crash-shell ...
--crash-reboot
Automatically reboot the system on crash. This switch has no effect when running as user instance. Thissetting may also be enabled during boot, on the kernel command line via the systemd.crash_reboot= option,see below.
systemd --crash-reboot ...
--confirm-spawn
Ask for confirmation when spawning processes. This switch has no effect when run as user instance.
systemd --confirm-spawn ...
--show-status
Takes a boolean argument or the special value auto. If on, terse unit status information is shown on theconsole during boot-up and shutdown. If off, no such status information is shown. If set to auto behavioris similar to off, except that it is automatically switched to on, as soon as the first unit failure orsignificant boot delay is encountered. This switch has no effect when invoked as user instance. Ifspecified, overrides both the kernel command line setting systemd.show_status= (see below) and theconfiguration file option ShowStatus=, see systemd-system.conf(5).
systemd --show-status ...
--log-target
Set log target. Argument must be one of console, journal, kmsg, journal-or-kmsg, null.
systemd --log-target ...
--log-level
Set log level. As argument this accepts a numerical log level or the well-known syslog(3) symbolic names(lowercase): emerg, alert, crit, err, warning, notice, info, debug.
systemd --log-level ...
--log-color
Highlight important log messages. Argument is a boolean value. If the argument is omitted, it defaults totrue.
systemd --log-color ...
--log-location
Include code location in log messages. This is mostly relevant for debugging purposes. Argument is aboolean value. If the argument is omitted it defaults to true.
systemd --log-location ...
--default-standard-output
Sets the default output or error output for all services and sockets, respectively. That is, controls thedefault for StandardOutput= and StandardError= (see systemd.exec(5) for details). Takes one of inherit,null, tty, journal, journal+console, syslog, syslog+console, kmsg, kmsg+console. If the argument isomitted --default-standard-output= defaults to journal and --default-standard-error= to inherit.
systemd --default-standard-output ...
--machine-id
Override the machine-id set on the hard drive, useful for network booting or for containers. May not beset to all zeros.
systemd --machine-id ...
--service-watchdogs
Globally enable/disable all service watchdog timeouts and emergency actions. This setting may also bespecified during boot, on the kernel command line via the systemd.service_watchdogs= option, see below.Defaults to enabled.
systemd --service-watchdogs ...
-h
Print a short help text and exit.
systemd -h ...
--version
Print a short version string and exit.CONCEPTSsystemd provides a dependency system between various entities called "units" of 11 different types. Unitsencapsulate various objects that are relevant for system boot-up and maintenance. The majority of units areconfigured in unit configuration files, whose syntax and basic set of options is described in systemd.unit(5),however some are created automatically from other configuration, dynamically from system state orprogrammatically at runtime. Units may be "active" (meaning started, bound, plugged in, ..., depending on theunit type, see below), or "inactive" (meaning stopped, unbound, unplugged, ...), as well as in the process ofbeing activated or deactivated, i.e. between the two states (these states are called "activating","deactivating"). A special "failed" state is available as well, which is very similar to "inactive" and isentered when the service failed in some way (process returned error code on exit, or crashed, an operationtimed out, or after too many restarts). If this state is entered, the cause will be logged, for laterreference. Note that the various unit types may have a number of additional substates, which are mapped to thefive generalized unit states described here.The following unit types are available:1. Service units, which start and control daemons and the processes they consist of. For details, seesystemd.service(5).2. Socket units, which encapsulate local IPC or network sockets in the system, useful for socket-basedactivation. For details about socket units, see systemd.socket(5), for details on socket-based activationand other forms of activation, see daemon(7).3. Target units are useful to group units, or provide well-known synchronization points during boot-up, seesystemd.target(5).4. Device units expose kernel devices in systemd and may be used to implement device-based activation. Fordetails, see systemd.device(5).5. Mount units control mount points in the file system, for details see systemd.mount(5).6. Automount units provide automount capabilities, for on-demand mounting of file systems as well asparallelized boot-up. See systemd.automount(5).7. Timer units are useful for triggering activation of other units based on timers. You may find details insystemd.timer(5).8. Swap units are very similar to mount units and encapsulate memory swap partitions or files of theoperating system. They are described in systemd.swap(5).9. Path units may be used to activate other services when file system objects change or are modified. Seesystemd.path(5).10. Slice units may be used to group units which manage system processes (such as service and scope units) ina hierarchical tree for resource management purposes. See systemd.slice(5).11. Scope units are similar to service units, but manage foreign processes instead of starting them as well.See systemd.scope(5).Units are named as their configuration files. Some units have special semantics. A detailed list is availablein systemd.special(7).systemd knows various kinds of dependencies, including positive and negative requirement dependencies (i.e.Requires= and Conflicts=) as well as ordering dependencies (After= and Before=). NB: ordering and requirementdependencies are orthogonal. If only a requirement dependency exists between two units (e.g. foo.servicerequires bar.service), but no ordering dependency (e.g. foo.service after bar.service) and both are requestedto start, they will be started in parallel. It is a common pattern that both requirement and orderingdependencies are placed between two units. Also note that the majority of dependencies are implicitly createdand maintained by systemd. In most cases, it should be unnecessary to declare additional dependenciesmanually, however it is possible to do this.Application programs and units (via dependencies) may request state changes of units. In systemd, theserequests are encapsulated as 'jobs' and maintained in a job queue. Jobs may succeed or can fail, theirexecution is ordered based on the ordering dependencies of the units they have been scheduled for.On boot systemd activates the target unit default.target whose job is to activate on-boot services and otheron-boot units by pulling them in via dependencies. Usually, the unit name is just an alias (symlink) foreither graphical.target (for fully-featured boots into the UI) or multi-user.target (for limited console-onlyboots for use in embedded or server environments, or similar; a subset of graphical.target). However, it is atthe discretion of the administrator to configure it as an alias to any other target unit. Seesystemd.special(7) for details about these target units.Processes systemd spawns are placed in individual Linux control groups named after the unit which they belongto in the private systemd hierarchy. (see cgroups.txt[1] for more information about control groups, or short"cgroups"). systemd uses this to effectively keep track of processes. Control group information is maintainedin the kernel, and is accessible via the file system hierarchy (beneath /sys/fs/cgroup/systemd/), or in toolssuch as systemd-cgls(1) or ps(1) (ps xawf -eo pid,user,cgroup,args is particularly useful to list allprocesses and the systemd units they belong to.).systemd is compatible with the SysV init system to a large degree: SysV init scripts are supported and simplyread as an alternative (though limited) configuration file format. The SysV /dev/initctl interface isprovided, and compatibility implementations of the various SysV client tools are available. In addition tothat, various established Unix functionality such as /etc/fstab or the utmp database are supported.systemd has a minimal transaction system: if a unit is requested to start up or shut down it will add it andall its dependencies to a temporary transaction. Then, it will verify if the transaction is consistent (i.e.whether the ordering of all units is cycle-free). If it is not, systemd will try to fix it up, and removesnon-essential jobs from the transaction that might remove the loop. Also, systemd tries to suppressnon-essential jobs in the transaction that would stop a running service. Finally it is checked whether thejobs of the transaction contradict jobs that have already been queued, and optionally the transaction isaborted then. If all worked out and the transaction is consistent and minimized in its impact it is mergedwith all already outstanding jobs and added to the run queue. Effectively this means that before executing arequested operation, systemd will verify that it makes sense, fixing it if possible, and only failing if itreally cannot work.systemd contains native implementations of various tasks that need to be executed as part of the boot process.For example, it sets the hostname or configures the loopback network device. It also sets up and mountsvarious API file systems, such as /sys or /proc.For more information about the concepts and ideas behind systemd, please refer to the Original DesignDocument[2].Note that some but not all interfaces provided by systemd are covered by the Interface Stability Promise[3].Units may be generated dynamically at boot and system manager reload time, for example based on otherconfiguration files or parameters passed on the kernel command line. For details, see systemd.generator(7).Systems which invoke systemd in a container or initrd environment should implement the Container Interface[4]or initrd Interface[5] specifications, respectively.DIRECTORIESSystem unit directoriesThe systemd system manager reads unit configuration from various directories. Packages that want toinstall unit files shall place them in the directory returned by pkg-config systemd
systemd --version ...
--variable=systemdsystemunitdir.
/lib/systemd/system. User configuration always takes precedence. pkg-config systemd
systemd --variable=systemdsystemunitdir. ...
--job-mode
SIGRTMIN+4Powers off the machine, starts the poweroff.target unit. This is mostly equivalent to systemctl startpoweroff.target --job-mode=replace-irreversible.SIGRTMIN+5Reboots the machine, starts the reboot.target unit. This is mostly equivalent to systemctl startreboot.target --job-mode=replace-irreversible.SIGRTMIN+6Reboots the machine via kexec, starts the kexec.target unit. This is mostly equivalent to systemctl startkexec.target --job-mode=replace-irreversible.SIGRTMIN+13Immediately halts the machine.SIGRTMIN+14Immediately powers off the machine.SIGRTMIN+15Immediately reboots the machine.SIGRTMIN+16Immediately reboots the machine with kexec.SIGRTMIN+20Enables display of status messages on the console, as controlled via systemd.show_status=1 on the kernelcommand line.SIGRTMIN+21Disables display of status messages on the console, as controlled via systemd.show_status=0 on the kernelcommand line.SIGRTMIN+22, SIGRTMIN+23Sets the log level to "debug" (or "info" on SIGRTMIN+23), as controlled via systemd.log_level=debug (orsystemd.log_level=info on SIGRTMIN+23) on the kernel command line.SIGRTMIN+24Immediately exits the manager (only available for --user instances).SIGRTMIN+26, SIGRTMIN+27, SIGRTMIN+28Sets the log target to "journal-or-kmsg" (or "console" on SIGRTMIN+27, "kmsg" on SIGRTMIN+28), ascontrolled via systemd.log_target=journal-or-kmsg (or systemd.log_target=console on SIGRTMIN+27 orsystemd.log_target=kmsg on SIGRTMIN+28) on the kernel command line.ENVIRONMENT$SYSTEMD_LOG_LEVELsystemd reads the log level from this environment variable. This can be overridden with --log-level=.$SYSTEMD_LOG_TARGETsystemd reads the log target from this environment variable. This can be overridden with --log-target=.$SYSTEMD_LOG_COLORControls whether systemd highlights important log messages. This can be overridden with --log-color=.$SYSTEMD_LOG_LOCATIONControls whether systemd prints the code location along with log messages. This can be overridden with
systemd --job-mode ...
--default-standard-output=
respectively.systemd.setenv=Takes a string argument in the form VARIABLE=VALUE. May be used to set default environment variables toadd to forked child processes. May be used more than once to set multiple variables.systemd.machine_id=Takes a 32 character hex value to be used for setting the machine-id. Intended mostly for network bootingwhere the same machine-id is desired for every boot.systemd.unified_cgroup_hierarchyWhen specified without an argument or with a true argument, enables the usage of unified cgrouphierarchy[8] (a.k.a. cgroups-v2). When specified with a false argument, fall back to hybrid or full legacycgroup hierarchy.If this option is not specified, the default behaviour is determined during compilation (the
systemd --default-standard-output= ...