Hey, folks, in this video, we are going to talk about system CTL Command.
We will run that command in our Linux environment.
This command is also pronounced as system control command.
It is used to start your application.
So in Windows, when you have an icon, you could double click on that icon to start that application.
But in Linux there is no gooey environment or most of the time guy is not used.
So then how do you start an application?
You start using the system CTL Command.
All right, so this command is a new tool to control system services.
And those system services are all Linux system services or also third party services as well.
It is available in version seven or later of RedHat or CentOS, and it replaces an older command, which
is a rich water service to control the service management.
All right.
So let's take a look at the usage of this command.
The very basic usage is running sys CTL and the options you have to give are the start, stop or status
of the service name.
Now I'm going to use a firewall dx, which is a preinstalled package in our Linux environment, and
we will use this firewall as an example to start, start or manage that service.
Then another example would be enable the service, meaning if you want that service or application to
start when your Linux machine starts at boot, then you want that service to start as well.
Then you could enable that service.
Also, you could restart or reload that service, meaning if you are or if you have made any configuration
changes in that service, then you could, after making the configuration changes, you could just go
and reload or restart that service.
Also system CTL You can run with the list units.
By the way, every service within the system, CTL management refers to ADD units.
So if you wanted to see what are the list of all the service units that are available to you, then
you could run a list units and that will give you all the units that are enabled.
But if you want to list all of the units or all of the services that are enabled are not enabled, then
you run the option all.
All right.
So when you run a list of units, you will get an output and that output will list or in columns.
First column will be unit, second load, active sub and description.
What are those?
I will tell you when we log into the system.
All right.
So without any further ado, I'm going to go ahead and log into our Linux machine.
I'm logging in as myself.
Let's do.
Who am I?
I'm logged in as myself.
Which directory I'm in.
I'm in my home directory.
And which.
What is my hostname.
My hostname in my first Linux VM.
So we confirmed we are in the right system where we where we are at this point.
All right, good.
So to to manage or to run that command, you have to be root or you could be pseudo command as long
if you are in a pseudo file by the way, which is Zulu command or how to be part of pseudo executions,
that will something we'll cover later on.
But for now, let's become root.
And her password.
All right, good.
Clear the screen.
Now, run system, CTL.
Let's first check the status of Firewall.
Firewall D, which is a demon and service.
All right.
So when you run it, it will tell you right away that the service is loaded, meaning the configuration
file of that service is loaded.
The system, DX or system CTL knows that it can reach its configuration file.
And by the way, that's where it's getting its configuration file.
And it is enabled, meaning when you start or when you restart a Linux machine, this service will be
active automatically.
Right now the current status is active and it's running.
It's documentation can be found in Man Firewall DX.
It's process ID right now as this state is 751.
The task to C group where are the other groups enabled for it?
And this is a quick log information of that service.
Now if you want to stop that service, you could simply hit a key or type it again.
Sys CTL Stop Firewall dot service.
Okay.
It is stopped.
Let's check the status now.
If it is, stop or not, so simply arrow key and status.
And right here you will see it says the configuration file is loaded.
However, the service itself is inactive, meaning it is not running good.
So if I want to disable the service to start at boot time then I have to do sys CTL disable.
Enable is to enable it to start at boot and disable to stop a boot firewall.
The.
All right.
It says it has removed all the links that are needed to have it start boot time.
Now, let's check the status for our world.
And right here, you see, as you see the service, the configuration file is known where it is and
it is disabled at Bhutan.
Beautiful.
All right.
So now let's run the next command, which is let's say if you are if you have made changes to the configuration
file, then you could use a restart or reload of the service, which will restart your service if you
wanted to know what are the list of services that are are available to you, then you run sys CTL list
units.
So our units.
Okay here.
It will give you all the loaded and active.
See right here, active service.
So the first one is this unit, which is the name of the service.
Second one is load.
Load means I have it right here.
Again, whether the unit configuration file has been passed by system D, the configuration file loaded
unit is kept in memory active a summary state above whether the unit is active sub.
This is a lower level state that indicates more detailed information about the unit and description.
A short textual description of what the unit is or does.
All right.
So this one, as I said, if you don't type dash dash all, then it will give you all the active ones.
But if you wanted to list all the system services that are enabled, active or inactive, then you run
lists, unit, dash, dash all and it will give you an active, inactive, whatever the state is, it
will give you everything.
See right here it says active if you keep going down C Right here it says inactive.
The service is dead so you can make it active.
You can restart the service.
By the way, you have all those services here.
Moving on to the next one is the other command to add a service under sys CTL management, meaning if
you have a third party application and you want that application or service to be managed by sys CTL
command, all you have to do is to create that service or unit file in a ETSI sys DX system directory
and it has to be named by service name dot service, and it has a certain pattern or format of the configuration
file which you could go in and check.
Then you could also control your entire Linux system with system CTL Command.
Yes.
How you can run system CTL Power off.
This will power off your entire system just like halt.
And you could also reboot your entire Linux machine by running system.
So let's try the last one system CTL reboot and this is going to reboot your entire machine.
There you go.
See, it is rebooting my entire machine.
So anyway, this is how you use the system CTL Command to manage all the services or applications inside
of your Linux machine.
I'll see you in the next lecture.