Systems CTL is the central management tool for several system operations. As you can see here, multiple user levels can use system CTL to manage system services. Let's take a deeper look. If you want to manage services in your machine, you'll have to use commands on the service target units. These are files with a suffix of.service. However, for most of service management commands, you don't need to specify the.service suffix as system they automatically knows it's a service file. Here we see a list of commands that can be performed on a service. It's important that you remember these commands as they'll come in handy. Start is the command to start a service. Similarly, we have restart, reload, reload or restart, enable, disable status and stop. Enable is used to ensure that the service will load automatically after the next system startup, disable is the opposite. You'll use the system CTL status, name of a service command to view the current status of the service, that is to determine whether it's active or not. Now, let's see these commands in action. Let's pick a service and run the system CTL command to manage that particular service. In this case, we use the NFS Server service. As you may know, NFS stands for network file system. This protocol let's us use a file system over the network as if it were connected to our local storage. First, we have the system CTL Start NFS server.service command, this starts the service. As we said earlier, this.service suffix is optional. Then let's issue the system CTL status NFS server.service command, and this views the status of the service. Notice after the active keyword that we see it's status is active. The exited keyword means that system D has successfully run the commands, but that it does not know there is a demo to monitor to determine that it is running. If there is, you must define it in the unit file by configuring the type and exact Start options appropriately according to whether the process you start is the main process, forced child processes and exits and so on. Then we restart this service with the system CTL restart and NFS -server.service commands, and reload the service with the system CTL reload NFS-server.service command. What's the difference between restarts and reload? Well, restart will stop the service if it's running and start it again. Reload however, will keep the service running while reading is configuration and loading that to memory. You can see how reload is beneficial when making changes to a live server. Next, we have the system CTL enable NFS server service command. This makes the service actively load after the next system startup. Then we have the command to stop the service. Finally, we have the system CTL set-default, multi minus user.target command. This command makes the multi user.targets the default Run level of the system. On reboot, the multiuser target will be the default target that gets mounted. While the commands, we saw a great how do I, for example, just check for yes or no type questions? For example, I just want to know if the NFS service is active or not, or if it is enabled for the next boot or not, or if it's currently inactive. Well, these types of commands are what are called scriptable commands. That is, you use it in script to just check for a Boolean output. The system CTL is -active, the name of service commands will return an exit code of 0 if the service is active. Remember that with bash commands they've returned code 0 means that everything executed successfully without errors. Similarly, we have a system control is -enabled and system control is -failed command. Now, let us look at a few more general purpose commands. Systems CTL list-units, that command will list all the units that systemd currently has in memory. This includes units that are either referenced directly or through a dependency. Units that are pinned by applications programmatically, or units that are active in the past and have failed. By default, only units which are active have pending jobs or have failed are shown. This can be changed with the --all option. Then we have the system CTL, list-dependencies, name of unit command. This will list all units that are required and wanted by the unit specified in the command. The show command can be used to show more details about a unit. Another interesting command is the mask command. You can use this to mask one or more units. This will link these unit files to /dev/now, making it impossible to start them. This is a stronger version of disabled since it prohibits all kinds of activation of the unit, including enablement and manual activation. Finally, we have the power off and reboot commands to shut down and reboot your machine. If you use either the power off or reboot commands with the --force option, then shutting off all running services is skipped. However, all processes are killed and all file systems are unmounted or mounted read-only immediately followed by the powering off. If --force is specified twice, the operation is immediately executed without terminating any processes or amounting any file systems. This may result in data loss. Note that when --force is specified twice the power of operations executed by a system CTL itself, and the system manager is not contacted. This means the commands should succeed even when the system manager has crashed. Let's now see a few examples of the commands we've talked about. First, we have the system CTL is active, NFS server.service. That command will check if the NFS server service is active, it shows as inactive. Then we check if the service is enabled by using the is enabled command. Then we have the system CTL list units command, which lists the units that the systemd currently has in memory. The system CTL show command without any optional parameters, lists, or properties about units, jobs, or the manager itself. Systems CTL, mask, NFS, server.service command prevents the service from starting again automatically. Finally, the reboot command to reboot the system. Finally, I also want to show you a comparison of commands between the older SysVinit and the newer systemd. It's unlikely you would encounter a Linux distribution that hasn't implemented systemd, but in older systems which haven't been updated, the commands on the left should help you, for example, to view the status of all services running on your Linux machine, Prouty Red Hat Enterprise Linux 7, you would run the service -status -all command, but on Linux 7 and later you add run, the service CTL list-units, --type, service, --all command. Similarly, we have used the CHK config command to enable or disable a service and to check a services status. Now, we have our system CTL replacements, as we see here. With system CTL, we can now filter dependencies for a target unit by specifying the --after or --before attributes to view services that are ordered to start before or after the specified unit.