systemctl

From LinuxReviews
Jump to navigationJump to search

systemctl is used to manage systemd services. It can be used to start, stop, enable, disable or mask services.

The name systemctl was deliberately chosen to confuse people. Given that there is also sysctl for the kernel , it would have been logical to name the thing systemdctl , but logic is not how systemD rolls.


Terminology

To understand systemd, you need to be familiar with this terminology:

Unit file — Encodes information about things such as a­ service, socket, device, mount, automount, target, snapshot, etc.

Target — A unit configuration file whose name ends in ­“.target” encodes information about a target unit of ­systemd, which is used for grouping units and as well-known synchronization point during startup.

Slice — A concept for hierarchically managing resources of a group of processes.

Seat — The set of hardware available at one work place (graphics card, keyboard, mouse, usb devices).

Session — A session is created once a user is logged on,­using a specific seat:

  • Only one session can be active per seat.
  • The default seat (for Linux consoles) is seat0. Hardware is assigned to seats, such as a VGA graphics card

HOWTO use systemctl

systemctl can be used to start, stop, enable, disable or mask services:

systemctl start unbound.service

the .service part is optional, systemctl start unbound has the same effect.

enable will add a service to the boot initiziation process, disable will prevent it from being started automatically. Adding --now to services when they are enabled or disabled will start or stop that service and make it start or stop at boot time.

systemctl eanble unbound.service --now

results in unbound being enabled at boot time and started immediately. That one command does the same as the these two commands:

systemctl start unbound.service --now systemctl enable unbound.service

Services who should never be used, ever, can be masked with mask.

Questions?


avatar

Anonymous user #1

one month ago
Score 0++
use alias systemdctl=systemctl for perfect confusion
Add your comment
LinuxReviews welcomes all comments. If you do not want to be anonymous, register or log in. It is free.