systemctl

Control the systemd system and service manager

systemctl [options …] command [name …]

Inspect and control the state of the "systemd" system and service manager.

Systemd manages processes (daemons) starting, stopping, recovery and environment, like cron, syslog, …

As is the case with all the documentation found here, this is terisfied and man systemctl should be consulted for the real details.

commands

-t t[,t …
--type=t[,t …
unit types: service, socket, busname, target, device, mount, automount, swap, timer, path, slice, scope
limit display to certain unit types.

help list allowed values and exit.

systemctl --type=socket
UNIT                            LOAD   ACTIVE SUB       DESCRIPTION
avahi-daemon.socket             loaded active running   Avahi mDNS/DNS-SD Stack Activation Socket
dbus.socket                     loaded active running   D-Bus System Message Bus Socket
syslog.socket                   loaded active running   Syslog Socket
systemd-fsckd.socket            loaded active listening fsck to fsckd communication Socket
systemd-initctl.socket          loaded active listening /dev/initctl Compatibility Named Pipe
systemd-journald-dev-log.socket loaded active running   Journal Socket (/dev/log)
systemd-journald.socket         loaded active running   Journal Socket
systemd-rfkill.socket           loaded active listening Load/Save RF Kill Switch Status /dev/rfkill Watch
systemd-udevd-control.socket    loaded active running   udev Control Socket
systemd-udevd-kernel.socket     loaded active running   udev Kernel Socket
triggerhappy.socket             loaded active running   triggerhappy.socket

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

11 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use systemctl list-unit-files.


systemctl --type=target UNIT LOAD ACTIVE SUB DESCRIPTION basic.target loaded active active Basic System bluetooth.target loaded active active Bluetooth cryptsetup.target loaded active active Encrypted Volumes getty.target loaded active active Login Prompts local-fs-pre.target loaded active active Local File Systems (Pre) local-fs.target loaded active active Local File Systems multi-user.target loaded active active Multi-User System network-online.target loaded active active Network is Online network.target loaded active active Network nfs-client.target loaded active active NFS client services paths.target loaded active active Paths remote-fs-pre.target loaded active active Remote File Systems (Pre) remote-fs.target loaded active active Remote File Systems slices.target loaded active active Slices sockets.target loaded active active Sockets sound.target loaded active active Sound Card swap.target loaded active active Swap sysinit.target loaded active active System Initialization time-sync.target loaded active active System Time Synchronized timers.target loaded active active Timers
target encodes information about a target unit for grouping units and as well-known synchronization points during start-up.
Have no specific options.

Group units via dependencies (useful as boot targets), and to establish standardized names for synchronization points used in dependencies between units.

Automatic dependencies: Unless DefaultDependencies=no in either of related units or an explicit ordering dependency is already defined, target units implicitly complement all configured dependencies of type Wants or Requires with dependencies of type After=. that Wants= or Requires= must be defined in the target unit itself
for example define Wants=some.target in some.service, implicit ordering will not be added.

All targets gain Conflicts dependency against shutdown.target unless DefaultDependencies=no.

--state=state Show only units in states :
  • LOAD : stub, loaded, not-found, error, merged, masked
  • ACTIVE : active, reloading, inactive, failed, activating, deactivating
  • SUB:
    • automount : dead, waiting, running, failed
    • busname : dead, making, registered, listening, running, sigterm, sigkill, failed
    • device : dead, tentative, plugged
    • mount : dead, mounting, mounting‑done, mounted, remounting, unmounting, mounting‑sigterm, mounting‑sigkill, remounting‑sigterm, remounting‑sigkill, unmounting‑sigterm, unmounting‑sigkill, failed
    • path : dead, waiting, running, failed,
    • scope : dead, running, abandoned, stop‑sigterm, stop‑sigkill, failed
    • service : dead, start‑pre, start, start‑post, running, exited, reload, stop, stop‑sigabrt, stop‑sigterm, stop‑sigkill, stop‑post, final‑sigterm, final‑sigkill, failed, auto‑restart
    • slice : dead, active
    • socket : dead, start‑pre, start‑chown, start‑post, listening, running, stop‑pre, stop‑pre‑sigterm, stop‑pre‑sigkill, stop‑post, final‑sigterm, final‑sigkill, failed
    • swap : dead, activating, activating‑done, active, deactivating, activating‑sigterm, activating‑sigkill,
      deactivating‑sigterm, deactivating‑sigkill, failed
    • target : dead, active
    • timer : dead, waiting, running, elapsed, failed

help list allowed values and exit. (shown above)

Example:

systemctl --state=failed # show only failed units.

pi94graf 6/14/22
Example:

> systemctl --state=not-found                      
  UNIT                           LOAD      ACTIVE   SUB  DESCRIPTION                   
* tmp.mount                      not-found inactive dead tmp.mount                     
* apparmor.service               not-found inactive dead apparmor.service              
* auditd.service                 not-found inactive dead auditd.service                
* bthelper.service               not-found inactive dead bthelper.service              
* console-screen.service         not-found inactive dead console-screen.service   

> systemctl --state=masked
  UNIT                LOAD   ACTIVE   SUB  DESCRIPTION                                                                                      
* mountkernfs.service masked inactive dead mountkernfs.service    
-l
--full
in the output of status, list-units, list-jobs, and list-timers do not ellipsize unit names, process tree entries, journal output, or truncate unit descriptions
--job-mode= When queuing a new job, how to deal with already queued jobs.
Default: replace except with isolate .

fail if a requested operation conflicts with a pending job (more specifically: causes an already pending start job to be reversed into a stop job or vice versa), cause the operation to fail.
replace (default) any conflicting pending job will be replaced, as necessary.
replace-irreversibly like "replace", but also mark the new jobs as irreversible. This prevents future conflicting transactions from replacing these jobs (or even being enqueued while the irreversible jobs are still pending). Irreversible jobs can still be cancelled using the cancel command.
isolate is only valid for start and causes all other units to be stopped when the specified unit is started. Always used when the isolate command is used.
flush queued jobs are canceled when the new job is enqueued.
ignore-dependencies all unit dependencies are ignored for this new job and the operation is executed immediately.
If passed, no required units of the unit passed will be pulled in, and no ordering dependencies will be honored. Debugging and rescue tool and should not be used by applications.
ignore-requirements is similar to ignore-dependencies, but only causes the requirement dependencies to be ignored, the ordering dependencies will still be honored.
-i --ignore-inhibitors When shutdown or a sleep state is requested, ignore inhibitor locks.
Applications establish inhibitor locks to prevent critical operations (such as CD burning ) from being interrupted by shutdown or a sleep state.
Without --ignore-inhibitors if locks have been taken, shutdown and sleep will fail and list active locks.
-q
--quiet
Suppress some of the output the hints about truncated log lines.
Does not suppress output of commands for which the output is the only result (like show).
Errors are always output.
--no-block Do not wait for the operation to finish.
If not specified, the job will be verified, enqueued and systemctl will wait until the unit's start-up is completed.
--wait wait indefinitly for started units to terminate again. Beware of services which use RemainAfterExit=yes.
--user Use service manager of the calling user.
--system Use service manager of the system. Default
--no-ask-password When used with start and related commands, disables asking for passwords. Background services may require input of a password or passphrase string, for example to unlock system hard disks or cryptographic certificates. Unless this option is specified and the command is invoked from a terminal, systemctl will query the user on the terminal for the necessary secrets. Use this option to switch this behavior off. In this case, the password must be supplied by some other means (for example graphical password agents) or the service might fail. This disables querying the user for authentication for privileged operations.
-f
--force
When used with halt, poweroff, reboot or kexec, execute the selected operation without shutting down all units. However, all processes will be killed forcibly and all file systems are unmounted or remounted read-only. This is hence a drastic but relatively safe option to request an immediate reboot. If --force is specified twice for these operations (with the exception of kexec), they will be executed immediately, without terminating any processes or unmounting any file systems. Warning: specifying --force twice with any of these operations might result in data loss. Note that when --force is specified twice the selected operation is executed by systemctl itself, and the system manager is not contacted. This means the command should succeed even when the system manager hangs or crashed.
--root=/path with enable/disable/is-enabled (and related commands), root path when looking for unit files.
Operate on the file system directly, instead of communicating with the systemd to carry out changes.
--runtime with enable, disable, edit, (and related commands), changes are not preserved for next boot.
Changes are not made in subdirectories of /etc but in /run, with identical immediate effects, Similarly, when used with set-property, make changes only temporarily, so that they are lost on the next reboot.
-H [uname@]host[:container]
--host= …
Execute the operation remotely.
container on the specified host. This will use SSH to talk to the remote machine manager instance. Container names may be enumerated with machinectl -H HOST.
-M
--machine=
Execute operation on a local container. Specify a container name to connect to.
--no-pager Do not pipe output into a pager.
--no-legend Do not print the legend, i.e. column headers and the footer with hints.
-h, --help
--version

COMMANDS

Unit Commands

Glob patterns operate on the set of primary names of units currently in memory.

list-units [jjj] currently in memory. includng units that are either referenced directly or through a dependency, units that are pinned by applications programmatically, or units that were active in the past and have failed.
Default only units which are active, have pending jobs, or have failed are shown.
Filtered by --type and --state

This is the default command. example

   -a
  --all
With list-units, show inactive units and units which are following other units.
When showing unit/job/manager properties, show all properties

To list all units installed in the file system, use list-unit-files .

With list-dependencies, recursively show dependencies of all dependent units (by default only dependencies of target units are shown).

   -r
  --recursive
When listing units, show units of local containers. prefixed with containerName:.
    --reverse Show reverse dependencies between units with list-dependencies,
i.e. follow dependencies of type WantedBy=, RequiredBy=, PartOf=, BoundBy=, instead of Wants= and similar.
  --plain output as a list instead of a tree.
list-sockets [jjj…] currently in memory, ordered by listening address.
output similar to:

               LISTEN           UNIT                        ACTIVATES
               /dev/initctl     systemd-initctl.socket      systemd-initctl.service
               ...
               [::]:22          sshd.socket                 sshd.service
               kobject-uevent 1 systemd-udevd-kernel.socket systemd-udevd.service

               5 sockets listed.
addresses might contains spaces, this output is not suitable for programmatic consumption.
  --show-types When showing sockets
list-timers [jjj] currently in memory, ordered by the time they elapse next. see --show-types, --all, and --state
 > systemctl list-timers
NEXT                         LEFT          LAST                         PASSED       UNIT                         ACTIVATES
Thu 2019-01-17 21:01:10 EST  35min left    Thu 2019-01-17 20:03:46 EST  21min ago    anacron.timer                anacron.service
Fri 2019-01-18 01:16:09 EST  4h 50min left Thu 2019-01-17 08:23:30 EST  12h ago      apt-daily.timer              apt-daily.service
Fri 2019-01-18 06:36:37 EST  10h left      Thu 2019-01-17 06:58:46 EST  13h ago      apt-daily-upgrade.timer      apt-daily-upgrade.service
Fri 2019-01-18 16:58:09 EST  20h left      Thu 2019-01-17 16:58:09 EST  3h 27min ago systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.ser
 
4 timers listed.
Pass --all to see loaded but inactive timers, too
list-dependencies [jjj] Shows units required and wanted by the specified unit. recursively lists units following the Requires=, Requisite=, ConsistsOf=, Wants=, BindsTo= dependencies.
If no unit is specified, default.target is implied.
By default, only target units are recursively expanded.
With --all is passed, all other units are recursively expanded as well.
  --plain output as a list instead of a tree --reverse--after, --before may be used to change what types of dependencies are shown.
 systemctl list-dependencies remote-fs.target
remote-fs.target
* `-nfs-client.target
*   |-auth-rpcgss-module.service
*   |-nfs-blkmap.service
*   `-remote-fs-pre.target
   -a
  --all
recursively show dependencies of all dependent units (by default only dependencies of target units are shown).
   --after show the units that are ordered before the specified unit. i.e. recursively list units following After= dependency.

Any After= dependency is mirrored to create a Before= dependency.
Temporal dependencies may be specified explicitly, but are created implicitly for units which are WantedBy= targets (see systemd.target(5)), and as a result of other directives (for example RequiresMountsFor=).
Both explicitly and implicitly introduced dependencies are shown with list-dependencies.

   --before show the units that are ordered after the specified unit. i.e. recursively list units following Before= dependency.
Unit File Commands
is-active jjj
is-failed jjj
Outputs the current unit state unless --quiet is specified,
Returns 0 if at least one is active|failed, or non-zero otherwise.

From syslog:

daemon.warning systemd[1]: ruuvicollector.service: Failed with result 'exit-code'.

 systemctl is-active RuuviCo*    ; echo $?
3
 systemctl is-failed RuuviCo*    ; echo $?
1
 systemctl is-failed ruuvicollector.service ; echo $?
activating
1
is-enabled name If any of the unit files are enabled returns exit code of 0
--full shows installation targets
Outputs the current enable status unless --quiet is specified
exit code
enabled
enabled-runtime
Enabled via .wants/, .requires/ or alias symlinks
(permanently in /etc/systemd/system/ or transiently in /run/systemd/system/).
0
disabled not enabled, but contains an [Install] section . > 0
masked
masked-runtime
Completely disabled, so that any start operation on it fails
(permanently in /etc…or transiently in /run…), even though the unit file might reside outside of the unit file search path.
> 0
static unit file is not enabled and has no provisions for enabling in the [Install] section. <0
indirect unit itself is not enabled, has Also=jj setting in the [Install] section, listing other unit files that might be enabled. 0
generated The unit file was generated dynamically via a generator tool. See systemd.generator(7). Generated unit files may not be enabled, they are enabled implicitly by their generator. 0
transient The unit file has been created dynamically with the runtime API. Transient units may not be enabled. 0
bad unit file is invalid or an error occurred.
is-enabled does not display this state, rather it outputs an error message.
the unit file listing printed by list-unit-files might show it.
> 0
status [jjj|pid]] Show runtime status and most recent log data from the (N.B. cut to terminal width!!)
If no units are specified, shows system status.
With --all, shows the status of all units (subject to limitations specified with --type).

By default, only shows 10 lines of output and ellipsizes lines to fit in the terminal window.
see --lines and --full,
journalctl --unit=NAME or journalctl --user-unit=NAME use a similar filter for messages and might be more convenient.

 sudo systemctl status influxdb       
* influxdb.service - InfluxDB is an open-source, distributed, time series database
   Loaded: loaded (/lib/systemd/system/influxdb.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2018-12-01 19:24:27 EST; 1h 22min ago
     Docs: https://docs.influxdata.com/influxdb/
 Main PID: 14600 (influxd)
   CGroup: /system.slice/influxdb.service
           `-14600 /usr/bin/influxd -config /etc/influxdb/influxdb.conf


Dec 01 20:15:43 pi93graf influxd[14600]: [httpd] ::1 - - [01/Dec/2018:20:15:43 -0500] 
    "POST /query?chunked=true&db=ruuvi&q=select+distinct%2  widen terminal 
Dec 01 20:15:58 pi93graf influxd[14600]: [httpd] ::1 - - [01/Dec/2018:20:15:58 -0500] 
    "POST /query?chunked=true&db=ruuvi&q=SELECT+DISTINCT%2  window
Dec 01 20:16:15 pi93graf influxd[14600]: [httpd] ::1 - - [01/Dec/2018:20:16:15 -0500] \
    "POST /query?chunked=true&db=ruuvi&q=SELECT+DISTINCT%2  to see all
Dec 01 20:16:21 pi93graf influxd[14600]: [httpd] ::1 - - [01/Dec/2018:20:16:21 -0500] 
    "POST /query?chunked=true&db=ruuvi&q=SELECT+DISTINCT%2  of the 
Dec 01 20:16:59 pi93graf influxd[14600]: [httpd] ::1 - - [01/Dec/2018:20:16:59 -0500] 
    "POST /query?chunked=true&db=ruuvi&q=SELECT+minium%28b  log message
Dec 01 20:17:31 pi93graf influxd[14600]: [httpd] ::1 - - [01/Dec/2018:20:17:31 -0500] 
    "POST /query?chunked=true&db=ruuvi&q=SELECT+min%28batt
Dec 01 20:17:48 pi93graf influxd[14600]: [httpd] ::1 - - [01/Dec/2018:20:17:48 -0500] 
    "POST /query?chunked=true&db=ruuvi&q=SELECT+min%28batt
Dec 01 20:18:04 pi93graf influxd[14600]: [httpd] ::1 - - [01/Dec/2018:20:17:55 -0500] 
    "POST /query?chunked=true&db=ruuvi&q=SELECT+min%28batt
Dec 01 20:18:43 pi93graf influxd[14600]: [httpd] ::1 - - [01/Dec/2018:20:18:30 -0500] 
    
    "POST /query?chunked=true&db=ruuvi&q=SELECT+mac%2C+min
Dec 01 20:22:28 pi93graf influxd[14600]: [httpd] ::1 - - [01/Dec/2018:20:22:10 -0500] 
    "POST /query?chunked=true&db=ruuvi&q=SELECT+mac%2C+min

Warning: influxdb.service changed on disk. Run 'systemctl daemon-reload' to reload units.
       
  -n
  --lines=n
with status, number of journal lines to show, counting from the most recent ones. Default 10.
   -o with status, formatting journal entries. see journalctl. Default short
   --output=short| short-full| short-iso| short-precise| short-monotonic| short-unix| verbose| export|
         json| json-pretty| json-sse| cat
show [jjj|job]]
  --value
output only the value
Show properties of one or more units, jobs, or the manager itself.
If no argument is specified, properties of the manager will be shown.
If a unit name is specified, properties of the unit are shown, and
if a job ID is specified, properties of the job are shown.
By default, empty properties are suppressed. Use --all to show those too.
To select specific properties to show, use --property=.
used when parsable output is required. Use status for formatted human-readable output.
systemctl show           
Version=232
Features=+PAM +AUDIT +SELINUX +IMA +APPARMOR 
    +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT 
    +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +
Architecture=arm
FirmwareTimestampMonotonic=0
LoaderTimestampMonotonic=0
  UNKN = Wed 1969-12-31 19:00:00 EST
KernelTimestamp=UNKN
KernelTimestampMonotonic=0
InitRDTimestampMonotonic=0
UserspaceTimestamp=UNKN
UserspaceTimestampMonotonic=1717322
FinishTimestamp=Mon 2018-11-05 12:23:01 EST
FinishTimestampMonotonic=20937116

SecurityStartTimestamp=UNKN
SecurityStartTimestampMonotonic=1754193
SecurityFinishTimestamp=UNKN
SecurityFinishTimestampMonotonic=1758961

GeneratorsStartTimestamp=Thu 2016-11-03 13:16:42 EDT
GeneratorsStartTimestampMonotonic=2020354
GeneratorsFinishTimestamp=Thu 2016-11-03 13:16:42 EDT
GeneratorsFinishTimestampMonotonic=2611909

UnitsLoadStartTimestamp=Thu 2016-11-03 13:16:42 EDT
UnitsLoadStartTimestampMonotonic=2624651

UnitsLoadFinishTimestamp=Thu 2016-11-03 13:16:43 EDT
UnitsLoadFinishTimestampMonotonic=3010388
LogLevel=info
LogTarget=journal-or-kmsg
NNames=232
NFailedUnits=0
NJobs=0
NInstalledJobs=192
NFailedJobs=0
Progress=1
Environment=LANG=C.UTF-8 
    PATH=/usr/local/sbin:
        /usr/local/bin:
        /usr/sbin:
        /usr/bin:
        /sbin:/bin
ConfirmSpawn=no
ShowStatus=no
UnitPath=
    /run/systemd/transient 
    /etc/systemd/system     
    /run/systemd/system 
    /run/systemd/generator  
    /lib/systemd/system 
    /usr/lib/systemd/system 
    /
DefaultStandardOutput=journal DefaultStandardError=journal RuntimeWatchdogUSec=0 ShutdownWatchdogUSec=10min SystemState=running DefaultTimerAccuracyUSec=1min DefaultTimeoutStartUSec=1min 30s DefaultTimeoutStopUSec=1min 30s DefaultRestartUSec=100ms DefaultStartLimitIntervalSec=10000000 DefaultStartLimitBurst=5 DefaultCPUAccounting=no DefaultBlockIOAccounting=no DefaultMemoryAccounting=no DefaultTasksAccounting=yes
DefaultLimits ; 
++unlimited++ ==
18446744073709551615
i.e. FFFFFFFF FFFFFFFF
 CPU=++unlimited++
 CPUSoft=++unlimited++
 FSIZE=++unlimited++
 FSIZESoft=++unlimited++
 DATA=++unlimited++
 DATASoft=++unlimited++
 STACK=++unlimited++
 STACKSoft=8388608
 CORE=++unlimited++
 CORESoft=0
 RSS=++unlimited++
 RSSSoft=++unlimited++
 NOFILE=4096
 NOFILESoft=1024
 AS=++unlimited++
 ASSoft=++unlimited++
 NPROC=3400
 NPROCSoft=3400
 MEMLOCK=65536
 MEMLOCKSoft=65536
 LOCKS=++unlimited++
 LOCKSSoft=++unlimited++
 SIGPENDING=3400
 SIGPENDINGSoft=3400
 MSGQUEUE=819200
 MSGQUEUESoft=819200
 NICE=0
 NICESoft=0
 RTPRIO=0
 RTPRIOSoft=0
 RTTIME=++unlimited++
 RTTIMESoft=++unlimited++

DefaultTasksMax=4915
-p p[,p …
--property= p[,p …
With show unit/job/manager properties with, limit display to properties specified, such as "MainPID". .
Shell completion is implemented for property names.
For the manager itself, systemctl show will show all available properties. See systemd-system.conf(5).

Properties for units vary by unit type, so showing any unit lists properties pertaining to this type.
Showing any job will list properties pertaining to all jobs.
Properties are documented in systemd.unit(5), and individual unit types systemd.service(5), systemd.socket

cat jjj Show backing files of one or more units.
Prints the "fragment" and "drop-ins" (source files) of units.
Each file is preceded by a comment which includes the file name.
Shows the contents of the backing files on disk, which may not match the system manager's understanding of these units if any unit files were updated on disk and the daemon-reload command wasn't issued since.
set-property name
                  assignment

 [--runtime]
Set unit properties at runtime, changing configuration parameter properties such as resource control settings at runtime.
Not all properties may be changed at runtime, settings in systemd.resource-control(5)) may.
The changes are applied immediately and stored on disk . With --runtime the settings only apply until the next boot.
The syntax of the property assignment follows the syntax of assignments in unit files.

Example: systemctl set-property foobar.service CPUShares=777

If the unit appears to be inactive, the changes will be stored on disk and will be effective when the unit will be started.

Allows changing multiple properties at the same time, which is preferable over setting them individually.
Assigning the empty list to list parameters will reset the list.

help jjj|PID Show manual pages.
reset-failed [jjj] Default all units.
When a unit fails (example: exiting with non-zero error code, terminating abnormally or timing out), it enters the "failed" state and its exit code and status is recorded until the service is restarted or reset with this command.
list-unit-files [jjj] List unit files installed on the system, in combination with their enablement state (as reported by is-enabled).
UNIT FILE                              STATE
proc-sys-fs-binfmt_misc.automount      static
-.mount                                generated
boot.mount                             generated
dev-hugepages.mount                    static   
dev-mqueue.mount                       static   
proc-fs-nfsd.mount                     static   
proc-sys-fs-binfmt_misc.mount          static   
run-rpc_pipefs.mount                   static   
sys-fs-fuse-connections.mount          static   
sys-kernel-config.mount                static   
sys-kernel-debug.mount                 static   
varnew.mount                           generated
systemd-ask-password-console.path      static   
systemd-ask-password-plymouth.path     static   
systemd-ask-password-wall.path         static   
session-c1.scope                       transient
2ping.service                          disabled 
alsa-restore.service                   static   
alsa-state.service                     static   
alsa-utils.service                     masked   
anacron.service                        enabled  
…
bluemon.service                        generated
bluetooth.service                       enabled  
bootlogd.service                        masked   
bootlogs.service                        masked   
bootmisc.service                        masked   
bthelper@.service                      static   
checkfs.service                         masked   
checkroot-bootclean.service             masked   
…
grafana-server.service                 masked   
grafana.service                        masked   
halt.service                           masked   
hciuart.service                        enabled  
hostname.service                       masked   
hwclock.service                        masked   
ifup@.service                          static   
influx.service                         disabled 
influxd.service                        enabled  
influxdb.service                       enabled  

…
rc-local.service                       static   
rc.local.service                       static   
…
resize2fs_once.service                 generated 
…
rsyslog.service                        enabled  
ruuvicollector.service                 enabled  
…
wpa_supplicant.service                 disabled 
wpa_supplicant@.service                disabled 
…
bluetooth.target                       static   
…
umount.target                          static   
anacron.timer                          enabled    
apt-daily-upgrade.timer                enabled    
apt-daily.timer                        enabled    
systemd-tmpfiles-clean.timer           static  

290 unit files listed.

       
enable name…, path…
 [--force]
 [--now]
 [--runtime]
 [--no-reload]
Creates a set of symlinks, as per the [Install] sections of the unit files.
--force overwrite any existing conflicting symlinks.

System manager configuration is reloaded to ensure the changes effected immediately unless --no-reload.

Does not start units being enabled (unless --now or invoke start with appropriate arguments later.)
In case of unit instance enablement (i.e. enablement of units of the form foo@bar.service), symlinks named the same as instances are created in the unit configuration directory, which point to the single template unit file they are instantiated from.

Expects unit names (in which case various unit file directories are automatically searched for unit files with appropriate names), or absolute paths to unit files (in which case these files are read directly).
If a specified unit file is located outside of the usual unit file directories, an additional symlink is created, linking it into the unit configuration path, thus ensuring it is found when requested by commands such as start.

Outputs file system operations executed, suppress with --quiet.

Creates only the symlinks suggested in the [Install] section of the unit files.

Changes can be made by placing or removing symlinks below this directory. Useful to create configurations that deviate from the suggested default installation.
Use reload daemon to effect the changes

Depending on whether --system, --user, --runtime, or --global is specified, this enables the unit for the system, for the calling user only, for only this boot of the system, or for all future logins of all users, or only this boot. in the last case, no systemd daemon configuration is reloaded.

masked units cannot be enabled.

--now units will be started if enabled.

reenable name Combination of disable and enable. Useful to reset symlinks a unit file is enabled with to the defaults configured in its [Install].
name must be a unit name.
disable name
 [--no-reload]
 [--runtime]
 [--now]
Removes symlinks to the unit files backing the specified units from the unit configuration directory, and undoes any changes made by enable or link.
Removes all symlinks to matching unit files, including manually created ones
Also= units are disable as well.

Not symmetric with enable, as disable may remove more symlinks than a prior enable invocation of the same unit created.
Does not implicitly stop the units that are being disable unless --now or invoke the stop later.

outputs information about the file system operations (symlink removals) executed. may be suppressed with --quiet.

Honors --system, --user, --runtime and --global in a similar way as enable.

Reloads system manager configuration after completing the operation unless --no-reload.

--now the units disabled will be stopped

--global With enable and disable, operate on the global user directory, i.e. for all future logins of all users.
mask name
 [--now]
Link these unit files to /dev/null, making it impossible to start them.
Stronger than disable, since it prohibits all kinds of activation of the unit, including enablement and manual activation. Use this option with care.
--now the units masked are stopped.
Honors --runtime to only mask temporarily until the next reboot of the system.
Expects valid unit names only, it does not accept unit file paths.
unmask name Unmask unit files. unit names only, not unit file paths.
preset name Reset the enable/disable status unit files, to the defaults configured in the preset policy files.
Same as disable or enable depending how the unit is listed in the preset files.

If the unit ihas no install information, it will be silently ignored .
name must be the real unit name, alias names are ignored .
See systemd.preset(5).

   --preset-mode= with the preset or preset-all commands,   full (the default), enable-only, disable-only.
controls whether units shall be disabled and enabled according to the preset rules, or only enabled, or only disabled.
preset-all Resets all installed unit files to the defaults configured in the preset policy file (see above).
linked
linked-runtime
Made available through one or more symlinks to the unit file
(permanently in /etc…or transiently in /run…), even though the unit file might reside outside of the unit file search path.
link PATH... Link a unit file that is not in the unit file search paths into the unit file search path. expects an absolute path to a unit file.
May be undone with disable. Makes a unit file available for commands such as start even though it is not installed directly in the unit search path.
revert name Revert unit files to their vendor versions. Removes drop-in configuration files that modify units, as well as any user-configured unit file that overrides a matching vendor supplied unit file.
For a unit foo.service the matching directories foo.service.d/ with all their contained files are removed, both below the persistent and runtime configuration directories (i.e. below /etc/systemd/system and /run/systemd/system); if the unit file has a vendor-supplied version (i.e. a unit file located below /usr) any matching persistent or runtime unit file that overrides it is removed.
If a unit file has no vendor-supplied version (i.e. is only defined below /etc/systemd/system or /run/systemd/system, but not in a unit file stored below /usr), it is not removed. Masked units are unmasked.

Used to undo all changes made with systemctl edit, systemctl set-property and systemctl mask and puts the original unit file with its settings back in effect.

add-wants target name
add-requires target name
 [--runtime]
 [--full]
 [--force]
 |--user|--system|--global]
Adds dependencies,
sudo systemctl  add-requires  ruuvicollector.service  influxdb.service
Created symlink /etc/systemd/system/ruuvicollector.service.requires/influxdb.service -> 
                                           /lib/systemd/system/influxdb.service.
edit name …
 [--runtime]
 [--full]
 [--force]
 |--user|--system|--global]
Edit a drop-in snippet or a whole replacement file
if --full is specified, to extend or override the specified unit.
Depending on whether --system (the default), --user, or --global is specified, creates a drop-in file for each unit either for the system, for the calling user, or for all futures logins of all users.
Then, the editor (see the "Environment" section below) is invoked on temporary files which will be written to the real location if the editor exits successfully.
With --full copy the original units instead of creating drop-in files.
With --force unit files will be created for editing if they don't exist.
With --runtime changes will be made temporarily in /run and they will be lost on the next reboot.

If the temporary file is empty upon exit, the modification of the related unit is canceled.

After the units have been edited, systemd configuration is reloaded (daemon-reload).
Cannot be used to remotely edit units and cannot temporarily edit units which are in /etc, since they take precedence over /run.

get-default Return the default target to boot into. target unit name default.target is aliased (symlinked) to.
set-default name Set the default target to boot into. This sets (symlinks) the default.target alias to the given target unit.
isolate name Allowed only on units where AllowIsolate= is enabled.
   grep AllowIsolate /etc/systemd/system

Start name and its dependencies and stop all others.
If no extension is given, .target is used is used

Similar to changing the runlevel in a traditional init system.

Immediately stops processes not enabled in the new unit, possibly including the graphical environment or terminal you are currently using.!,

start jjj Units not active and are not in a failed state usually are not in memory, and will not be matched by any pattern.
In case of instantiated units, systemd is often unaware of the instance name until the instance has been started.
using glob patterns with start has limited usefulness, secondary alias names of units are not considered.
stop jjj deactivate (issues SIGTERM)
try-restart jjj if the units are running.
try-reload-or-restart jjj Reload units if they support reload. If not, restart them ( most do not include reload).
restart jjj If not running , they will be started.
reload jjj Asks units to reload their configuration. ( most do not include reload)
Reloads the service-specific configuration, not the unit configuration file of systemd.
To reload the configuration file of a unit, use the daemon-reload
Example:
Apache: Apache's httpd.conf the web server, not the apache.service systemd unit file.
sudo systemctl reload influxdb
Failed to reload influxdb.service: 
    Job type reload is not applicable for unit influxdb.service.
See system logs and 'systemctl status influxdb.service' for details.
reload-or-restart jjj reload if they support it. If not, restart them, If the units are not running they will be started.
kill jjj Send a signal to one or more processes of the unit.
   -s SIGsss
   --signal= SIGsss
with kill, SIGTERM, SIGINT or SIGSTOP. default:TERM.
   --kill-who= with kill, which processes to send a signal to.
Must be one of main, control or all to select whether to kill only the main process, the control process or all processes of the unit.
The main process of the unit is the one that defines the life-time of it.
A control process of a unit is one that is invoked by the manager to induce state changes of it.
For example, all processes started due to the ExecStartPre=, ExecStop= or ExecReload= settings of service units are control processes.
there is only one control process per unit at a time, as only one state change is executed at a time.
For services of type Type=forking, the initial process started by the manager for ExecStart= is a control process, while the process ultimately forked off by that one is then considered the main process of the unit (if it can be determined). This is different for service units of other types, where the process forked off by the manager for ExecStart= is always the main process itself. A service unit consists of zero or one main process, zero or one control process plus any number of additional processes. Not all unit types manage processes of these types however. For example, for mount units, control processes are defined (which are the invocations of /bin/mount and /bin/umount), but no main process is defined. If omitted, defaults to all.
   --fail
   --job-mode=fail
with the kill command, if no units were killed, results in an error.

Machine Commands

sudo list-machines [jjj] List the host and all running local containers with their state.
  NAME            STATE    FAILED JOBS
* pi93graf (host) degraded      2    0

1 machines listed.
  --plain output as a list instead of a tree

Job Commands

list-jobs [jjj]
cancel [jjj] numeric job IDs. If no job ID is specified, cancel all pending jobs.

Environment Commands

show-environment passed to processes spawned.
systemctl show-environment
LANG=C.UTF-8
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
set-environment variable=value …
unset-environment variable [value] If only variable is specified, it will be removed .
If a variable and a value are specified, the variable is only removed if is value.
import-environment [variable] Import environment variables set on the client into the systemd manager environment block.
With no arguments the entire environment is imported.

Manager Lifecycle Commands

daemon-reload Reload the systemd manager configuration.
Rerun all generators (see systemd.generator(7)), reload all unit files, and recreate the entire dependency tree.
While the daemon is being reloaded, all sockets systemd listens on behalf of user configuration stay accessible.
daemon-reexec Reexecute the systemd manager.
for debugging and package upgrades. might be helpful as a heavy-weight daemon-reload
Serialize the manager state, reexecute the process and deserialize the state again.

System Commands

is-system-running Returns 0 when the system is fully up and running, specifically not in startup, shutdown or maintenance mode, and with no failed services.
Use --quiet to suppress this output.
Exit Code
running system is fully operational. 0
degraded system is operational but one or more units failed. 1
initializing Early bootup, before basic.target is reached or maintenance state entered. > 0
starting Late bootup, before job queue becomes idle for the first time, or one of the rescue targets are reached. > 0
maintenance rescue or emergency target is active. > 0
stopping manager is shutting down. > 0
offline manager is not running. Specifically, this is the operational state if an incompatible program is running as system manager (PID 1). > 0
unknown operational state could not be determined, due to lack of resources or another error > 0
default Enter default mode. mostly equivalent to
isolate default.target.
rescue Enter rescue mode. mostly equivalent to:
isolate rescue.target, outputs wall message
emergency Enter emergency mode. mostly equivalent to:
isolate emergency.target, outputs wall message
halt Shut down and halt the system. mostly equivalent to:
start halt.target --job-mode=replace-irreversibly,
Outputs wall message .
With --force shutdown of all running services is skipped, however all processes are killed and all file systems are unmounted or mounted read-only, immediately followed by the system halt.
With --force immediately executed without terminating processes or unmounting file systems.
Executed by systemctl itself, the system manager is not contacted. should succeed even when the system manager hangs or crashed.

Results in data loss.

poweroff Shut down and power-off the system. mostly equivalent to :
start poweroff.target
Same as halt (including --force ) followed by powering off.
reboot [arg] Shut down and reboot the system. mostly equivalent to start reboot.target --job-mode=replace-irreversibly, outputs wall message .
Same as halt (including --force options followed by a boot.
arg will be passed to the reboot(2) system call.
The value is architecture and firmware specific.
Example:
"recovery" might be used to trigger system recovery,
"fota" might be used to trigger a "firmware over the air" update.
--firmware-setup with reboot , indicate to the system's firmware to boot into setup mode. Only supported on some EFI systems and only if the system was booted in EFI mode.
kexec Shut down and boot the system via kexec. mostly equivalent to:
start kexec.target --job-mode=replace-irreversibly, output a wall message
--force as with halt, immediately followed by the boot.
   --message=mmm With halt, poweroff, reboot or kexec, reason logged with the default shutdown message.
   --no-wall Do not send wall message before halt, power-off, reboot.
suspend triggers suspend.target target.
hibernate triggers hibernate.target target.
hybrid-sleep triggers hybrid-sleep.target target.
exit [exit_code] Quit systemd manager with exit_code, only for user service managers (i.e. in conjunction with --user option) or in containers and is equivalent to poweroff otherwise.
switch-root rootdir [init] Switches to a different root directory and executes a new system manager process below it.
Intended for usage in initial RAM disks ("initrd"), and will transition from the initrd's system manager process (a.k.a. "init" process) to the main system manager process which is loaded from the actual host volume.
rootdir directory that is to become the new root directory,
the path to the new system manager binary below it to execute as PID 1.
Default init, a systemd binary will automatically be searched for and used as init.
By default the state of the initrd's system manager process is passed to the main system manager, allowing later inspection of the state of the services involved in the initrd boot phase.

Parameter Syntax

Unit commands take either a single unit name or multiple unit specifications (designated as jjj …).
If the suffix is not specified (unit name is "abbreviated") .service is by default, or
a type-specific suffix in case of commands which operate only on specific unit types.
For example:
           # systemctl start sshd 
       and 
           # systemctl start sshd.service
are equivalent, as are
 
           # systemctl isolate default 
       and 
           # systemctl isolate default.target
(absolute) paths to device nodes are converted to device unit names, and other (absolute) paths to mount unit names.
           /dev/sda  =>  dev-sda.device
           /home     =>  home.mount 

Shell-style globs will be matched against the primary names of all units currently in memory; literal unit names, with or without a suffix, will be treated as in the first case. Alias names of units, and units that aren't in memory are not considered for glob expansion. This means that literal unit names always refer to exactly one unit, but globs may match zero units and this is not considered an error.

Glob patterns use shell-style globbing rules and "*", "?", "[]" may be used.
The patterns are matched against the primary names of units currently in memory, and patterns which do not match anything are silently skipped. For example:

 # systemctl stop sshd@*.service 
will stop all sshd@.service instances.

For unit file commands, the specified NAME should be the name of the unit file (possibly abbreviated, see above), or the absolute path to the unit file:
           # systemctl enable foo.service 
       or 
           # systemctl link /path/to/foo.service

ENVIRONMENT

$SYSTEMD_EDITOR Editor to use when editing units; overrides $EDITOR and $VISUAL.
If neither $SYSTEMD_EDITOR nor $EDITOR nor $VISUAL are present or if it is set to an empty string or if their execution failed, systemctl will try to execute well known editors in this order: editor(1), nano(1), vim(1), vi(1).

$SYSTEMD_PAGER Pager to use when --no-pager is not given; overrides $PAGER. If neither $SYSTEMD_PAGER nor $PAGER are set, a set of well-known pager implementations are tried in turn, including less(1) and more(1), until one is found. If no pager implementation is discovered no pager is invoked. Setting this environment variable to an empty string or the value "cat" is equivalent to passing --no-pager.

$SYSTEMD_LESS Override the options passed to less (by default "FRSXMK").

$SYSTEMD_LESSCHARSET Override charset passed to less (default "utf-8", if the invoking terminal is determined to be UTF-8 compatible).

SEE ALSO

systemd(1), journalctl(1), loginctl(1), machinectl(1), systemd.unit, systemd.resource-control(5), systemd.special(7), wall(1), systemd.preset(5), systemd.generator(7), glob(7) systemd.conf
directives
system.com

ArchLinux
freeDeskTop.org/wiki/Software/systemd/Preset