Frequently Asked Question
What is a unit file and what types of unit are there?
Everything systemd manages is called a unit, and every unit is described by a small
text file in INI-style format. The file extension tells systemd what kind of unit it is.
The most common are .service (a program to run and supervise), .socket (a listening
socket that activates a service on demand), .timer (a schedule that triggers another
unit), .mount and .automount (filesystem mount points), .swap (a swap area),
.path (watch a filesystem path for changes), and .target (a grouping unit that
bundles other units together).
A handful of other types, .device, .slice, .scope, are mostly generated
automatically rather than written by hand. Unit files live in three directories that
systemd merges, with later directories overriding earlier ones: /usr/lib/systemd/system/
ships with packages, /run/systemd/system/ is for runtime-generated units, and
/etc/systemd/system/ is where you put your own. The same scheme repeats under the
user's home for per-user units (~/.config/systemd/user/).