[No audio]
Next lesson we have is about system maintenance
commands. Maintenance commands are those that are
used by system administrator to reboot the system,
shut it down, or bringing it in single mode, or
whatever the tasks they have to perform while
other system other users are logged in, or have
them log off, and then bring it to the single user
mode. The commands that are used to bring down a
Linux system is shutdown, init. Now init has a
different level of bringing the system down or
rebooting. It goes anywhere from 0 to 7. 0 for
simply shut down, and six is to reboot, and three
is to bring it in in multiuser mode, and there are
many other options. Then we have a reboot command.
As it read, reboot is simply to reboot your Linux
machine. And then we have halt command. halt shuts
down the computer. And if there are any processes
that are running, that needs some time to bring
down the process, halt doesn't care, it just shuts
down right away. It is as if you are pressing the
button on your physical system, the power button,
and holding it in, powering it down. It's just like
that. So now let's get into our Linux lab server,
and we will try out few of these commands. I will
log into the Linux machine by logging into the PuTTY.
I'll open it up.
[No audio]
Log in myself.
And of course who we are? We are self. Which directory we
are in, and which hosts are we on, because every
time you are ready to reboot a machine, this is
definitely a command you need to run, which is
hostname, to make sure which computer you are on or
which Linux machine you are on. So anyway, let's
clear the screen. And the first command is
shutdown. Of course, I don't want to shutdown
this machine right now because we're going through
the training. So I'll just quickly go through this
man page of shutdown. And you will see it tells
you shutdown, halt, power-off, or reboot the machine.
shutdown has different options if you want to use
these different options with it. And those options
are listed as you go down. If you type shutdown
-H, it will do exactly the same as
if you would just type halt, and P for power off,
r for reboot, h for equivalent to power off, unless
halt is specified. So you could view every single
options that is available with shutdown. Then we
have the next one is init.
[No audio]
init is a systemd service.
There are different options associated
with init, sorry with, guess with init, and those
options, you can view them one by one. As I said,
there are options zero to seven, you can view
those options and see what exactly they do. Then
we have reboot. reboot simply reboots your
computer, shuts it down, and power off, and bring it back online.
And the last one you have halt.
poweroff, reboot, halt, poweroff. So pretty much all
these commands. You could use any one of these
commands except the reboot command and init command. So
let's say, now we want to reboot our machine. In
order to reboot your machine, you have to be root.
[No audio]
So become root. And if I do reboot,
[No audio]
hit enter. And
you will see I have lost my PuTTY session. And if
you are logged into your console, you'll see the
system message is coming up, this system is going
down. So we'll give it some time. I will fast
forward from here.
[No audio]
Okay, so now I got the prompt
back, the system has been rebooted, I've logged back in.
[No audio]
Now your PuTTY terminal will continue to try
to connect to your system. If it's shut down, it
tries to connect it every second or every five
seconds depending on the setting that you have
specified, and your PuTTY options. So anyway, this
is sweet and simple and straightforward lesson
that we learned about four commands. Try them out
and get familiar with it.
[No audio]