- In this video, I will show you how to work with systemD.
So I have a couple of commands that I want to show you.
And here, we can see the commands.
Let me just show you.
So, as I mentioned, systemD is managing many things.
We use systemCTL, which is the main
systemD management command minus T help.
That will show you the different unit types
that it can manage.
And amongst these unit types,
you have the service as the most important.
But it can mount file systems.
It can take care of devices.
It can open network sockets.
It can do so much more.
If you wanna get an impression of everything
that it is doing, use systemCTL.
And before we do anything else,
let's do the tab completion.
Here you can see all the different commands
that you can use with systemCTL,
including list-unit-files, for instance.
What is that doing?
Well, that's showing all the different unit files
that are used on your system and their current status.
Nice to see what systemD is managing.
But we should not explore this in much detail right now,
because, as you can see, 382 unit files in total.
That's kind of impressive.
If you wanna know what is happening right now,
then systemCTL list-units is the best way to figure out.
That is showing the units currently loaded.
And as you can see,
it starts with a bunch of devices.
After the devices you have the mounts.
And yes, that is true systemD is taking over the work
of etc fstab, it's taking care of the mounts.
And here we can see the services.
Now let's take the cups service,
just a random service as an example.
We can see that the service is loaded,
it is active and it is running.
So loaded means that systemD is aware of the configuration.
And active means that it is currently active
And running means that the state is running.
That's not always the same
because you can also have a service that is active,
but in a state of exited,
as if the service has done its work
and it's already done with it.
Now, the most important things
in systemD is service management.
And in order to show you,
I'm going to install a software package.
So sudo, DNF install minus Y HTTPD.
That's installing the HTTP web server.
I don't care about the HTTPD web server here,
but I need an example.
So I just installed the web server
and I'm going to use sudo systemCTL status on HTTPD
to figure out the status of this server.
Now, what do we see here?
We see that the service is loaded.
Loaded means that systemD is aware
of the configuration file.
The configuration file
is usr/lib/systemD/system/HTTPD.service.
It is disabled, which means that it is not enabled
for automatic start at system boot.
And we also can see that it's inactive and dead.
Now let's change this and let's do a start on HTTPD.
Now I'm using status again.
And what do we see?
A whole lot more information.
We can see that it is active.
We can see information about the documentation,
but also information about the process IDs,
about the memory that it's using,
and even information from the logs.
This is what makes systemD so cool.
Services write the log information directly to systemD.
And if you use systemCTL status to get information
about your service, you automatically see that.
One more thing to be noticed.
And that is that the service is still disabled,
which means that it's not going to be started
automatically at system start.
And if you don't like that, well, we are just going to use
systemCTL enable on the service.
Enable means that the service is added
to its default environment.
And this default environment is a target.
The target defines the state that the system is starting in.
And here we can see multi-user target to which it is added.
We will talk about it later in just a bit.
If you use systemCTL status on HTTPD again,
now we can see that everything is configured.
The service is enabled, the service is active
and it is running and we are all good.
Now you can also do the opposite,
and that will be sudo systemCTL stop on HTTPD.
You can probably guess what is happening if you do that.
And that's right, we just stopped it.
Now, by stopping it we can still see
the relevant information, including log information,
because after all this thing has been active.
And that is quite kind of useful.
You don't have to explore any log files anymore.
All the information that you need is right here.
Now, this is a very important part of working with systemD,
management of these services.
There is more, and we will find out more about it
in the next couple of videos.