I keep finding, while googling, that they're located at /usr/lib/systemd/system/ and /etc/systemd/system/. However, in my ubuntu, the first doesn't even exist, and the other has only a few services

bluetooth.target.wants                      default.target.wants           hybrid-sleep.target.wants    shutdown.target.wants
dbus-org.bluez.service                      display-manager.service        multi-user.target.wants      sockets.target.wants
dbus-org.freedesktop.Avahi.service          display-manager.service.wants  network-online.target.wants  suspend.target.wants
dbus-org.freedesktop.ModemManager1.service  getty.target.wants             paths.target.wants           sysinit.target.wants
dbus-org.freedesktop.nm-dispatcher.service  graphical.target.wants         plexmediaserver.service      syslog.service
dbus-org.freedesktop.thermald.service       hibernate.target.wants         printer.target.wants         timers.target.wants

Where are the others?

When I run systemctl list-units I see so many services but I don't know where to locate them. For example, where is my plexmediaserver.service? I need to know because that's where I want to put my other units.


4 Answers 4


The package-provided service files are all usually located in /lib/systemd/system. For example, search for .service in the package index.

From man systemd.unit:



The latter ones are for user sessions. IIRC Ubuntu 16.04 still uses upstart for user sessions, so those files are only applicable from after 16.04.

For a specific service, to see what systemd is reading, run systemctl status <service> or systemctl show <service>:

$ systemctl show ssh.service | grep Path
$ systemctl status ssh.service
● ssh.service - OpenBSD Secure Shell server
   Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/ssh.service.d
   Active: active (running) since Thu 2017-01-26 16:06:53 JST; 21h ago
 Main PID: 948 (sshd)
   CGroup: /system.slice/ssh.service
           └─948 /usr/sbin/sshd -D
  • 1
    Thank you! Also, where are the others? I want to know all the places where the systemd init process will look for Commented Jan 27, 2017 at 3:42
  • 1
    @GuerlandoOCs see update.
    – muru
    Commented Jan 27, 2017 at 4:28

There are good tools to know about whenever you need to locate something.

The first is locate, which is used to locate files by name. It uses a pre-built index, so it's extremely fast. However, it sometimes misses new files that haven't been indexed, or may also miss files with restrictive permissions. In this case, a quick locate command would find all the systemd files on Ubuntu:

locate systemd

If you want to focus on that Plex file, you can use a pipe to filter the results:

locate systemd | grep plex

The other tool to know about is find, which does a live search of a particular directory to find files. It has a lot of options. Check man find for details. To look for plexmediaserver.service anywhere on your system, you would use:

find / -name plexmediaserver.service

Finally, in this case, you probably know which package that the file you are looking for belongs to. If you aren't sure of the exact package name, you can use this syntax to find all the package which contain 'plex' in their name:

dpkg -l '*plex*'

If you find that the package you are interested is named 'plexmediaserver', then you can use this syntax to list all the files in that package:

dpkg -L plexmediaserver

Again, you can use a pipe to filter the results to just the service file you are looking for:

dpkg -L plexmediaserver | grep plexmediaserver.service

Now you'll be able to find files for many common cases.


Using systemd-analyze command:

All folders which can contain user services:

systemd-analyze --user unit-paths

I prefer systemd-analyze --global unit-paths

All folders which can contain system services:

systemd-analyze --system unit-paths

See: manpage

  • 1
    Unknown operation unit-paths? Is that supposed to be replaced? with what?
    – Shanteva
    Commented Mar 11, 2021 at 15:12
  • @Shanteva you might have an older version of systemd. What I wrote there is the full command, nothing needs to be replaced
    – smac89
    Commented Nov 18, 2021 at 10:41
  • This is very helpful to me, thanks... Commented Mar 14, 2022 at 10:47

Three commands for three directories found in man systemd :

$ pkg-config systemd --variable=systemdsystemunitdir

$ pkg-config systemd --variable=systemdsystemconfdir

$ pkg-config systemd --variable=systemduserconfdir

I am running Ubuntu 20.04

Bonus note: systemctl status <service> produces more human readable output whereas systemctl show <service> produces more low level program readable output

  • They show different information: status: Show terse runtime status information about one or more units, followed by most recent log data from the journal. show: Show properties of one or more units, jobs, or the manager itself. Commented Nov 23, 2021 at 5:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .