[MUSIC] As we continue to learn about systemd, lets next take a look at systemd units. Now a unit in systemd refers to a resource that it can manage. You can do some operations on this managed unit using daemons and some other utilities. Another thing to remember is that in modern Linux systems, units, servers and abstraction to manage devices, services, file system mount points and so on. These Linux machines final unit files are typically under the slash lib slash systemd system directory. It is recommended not to edit on move unit files in this directory. If you like to edit the unit files they can be edited under the slash ETC slash systems slash system directory. If the systems copy of the unit files needs to be edited, you'd ideally put those files here and then edit them in place. Many times you'd want to create your own service. To do that, you create a bash script of your service, put it under slash user slash, been as an executable, then create this unit file under slash ETC slash systemd system to define these services properties. Then you can perform actions such as start or stop the service using these systems CTR utility. If you'd like to extend or override the attributes of a service unit type, you'll have to create a directory for that file. So for example, for this service test dot service, you create a directory called test dot service dot D and then have a dot com file within this directory to extend or override the services attributes. There are several types of units. The service type name is used as a suffix to reference a unit. So for example, test dot service refers to a service unit type and test device refers to a device unit type. Let's take a look at these different types of units. So first we have the service unit. It's the easiest to understand. You can start or stop the service, set various properties about when this service should be enabled, and so on. Then there's the target unit. This is used for grouping units as well known synchronization points during startup. Automount units may be used to implement on-demand mounting as well as paralyzed mounting of file systems. A unit configuration file whose name ends in dot automount, encodes information about a file system auto mount point controlled and supervised by systemd. Then we have the device unit, not all devices on the system need a systemd dot device unit. The device unit is used whenever a device needs systemd management by udev or the sys FS file system. By the way, udev is the device manager that creates or removes device attachments in the slash Dev Directory dynamically. By now you should get the point. The mount unit type is used for mount points, which can be managed by systemd. The path unit type encodes information about a path monitored by systemd for path based activation. A unit whose name ends in dot scope refers to a scope unit. Now scope units manage a set of system processes, unlike service units, scope units manage externally created processes and do not fork off processes on its own. A unit configuration file whose name ends in dot swap encodes information about a swap device or file for memory paging controlled and supervised by systemd. Swap units must be named after the devices or files they control. So for example, the swap device slash dev SDA 5 must be configured in a unit file dev minus SDA 5 swap. And finally timers are systemd unit files whose names end in dot timer that control dot service files or events. Timers can be used as an alternative to Cron. Timers have built in support for calendar time events, monotonic time events and can be run asynchronously. We saw before that the older sys fee in it used something called init scripts. An init script is a shell script with some metadata used by sysv init to manage a service or a process. With the advent of systemd in modern Linux distributions, all those init scripts are replaced by the dot service script. Service units end with the dots service file extension and serve a similar purpose as init scripts. You can view, start, stop, restart, enable or disable a service using these systems. CTL utility. Now that we have systemctl, it's recommended to use it. You may see some older documentation referring to the service commands to stop or start a service. Even though this might still work, depending upon the Linux distribution you have, it's recommended to replace those commands with these systems CTL command to do the same task. With systemd you can also create your own service as we briefly alluded before. As a quick recap, the idea is that you would create a bash script of your service, put it under slash user slash, been as an executable, then create this unit file under slash ETC slash systemd system to define these services properties. Then you can perform actions such as start or stop the service using these systems CTR utility. We hope this clarifies the concepts of creating and managing running services in your Linux machine to view all the services in your Linux machine, execute the CTL list minus units minus minus type equals service command. Or this systemctl minus minus type equals service command. You can filter this output to show only the running services using the command systemctl minus minus type equal service minus minus state equals running. [MUSIC]