1 00:00:00,000 --> 00:00:02,129 [No audio] 2 00:00:02,129 --> 00:00:05,129 Next lesson we have is about system maintenance 3 00:00:05,129 --> 00:00:08,399 commands. Maintenance commands are those that are 4 00:00:08,399 --> 00:00:11,879 used by system administrator to reboot the system, 5 00:00:11,879 --> 00:00:14,609 shut it down, or bringing it in single mode, or 6 00:00:14,609 --> 00:00:17,579 whatever the tasks they have to perform while 7 00:00:17,609 --> 00:00:20,729 other system other users are logged in, or have 8 00:00:20,729 --> 00:00:23,609 them log off, and then bring it to the single user 9 00:00:23,609 --> 00:00:28,169 mode. The commands that are used to bring down a 10 00:00:28,169 --> 00:00:33,869 Linux system is shutdown, init. Now init has a 11 00:00:33,869 --> 00:00:37,169 different level of bringing the system down or 12 00:00:37,169 --> 00:00:41,519 rebooting. It goes anywhere from 0 to 7. 0 for 13 00:00:41,519 --> 00:00:46,379 simply shut down, and six is to reboot, and three 14 00:00:46,379 --> 00:00:49,889 is to bring it in in multiuser mode, and there are 15 00:00:49,889 --> 00:00:53,489 many other options. Then we have a reboot command. 16 00:00:53,519 --> 00:00:57,479 As it read, reboot is simply to reboot your Linux 17 00:00:57,479 --> 00:01:02,639 machine. And then we have halt command. halt shuts 18 00:01:02,639 --> 00:01:06,959 down the computer. And if there are any processes 19 00:01:06,959 --> 00:01:09,539 that are running, that needs some time to bring 20 00:01:09,539 --> 00:01:13,109 down the process, halt doesn't care, it just shuts 21 00:01:13,109 --> 00:01:17,069 down right away. It is as if you are pressing the 22 00:01:17,069 --> 00:01:21,089 button on your physical system, the power button, 23 00:01:21,089 --> 00:01:23,969 and holding it in, powering it down. It's just like 24 00:01:23,969 --> 00:01:28,259 that. So now let's get into our Linux lab server, 25 00:01:28,289 --> 00:01:32,009 and we will try out few of these commands. I will 26 00:01:32,009 --> 00:01:38,569 log into the Linux machine by logging into the PuTTY. 27 00:01:38,569 --> 00:01:40,104 I'll open it up. 28 00:01:40,104 --> 00:01:42,657 [No audio] 29 00:01:42,657 --> 00:01:44,125 Log in myself. 30 00:01:45,592 --> 00:01:50,099 And of course who we are? We are self. Which directory we 31 00:01:50,099 --> 00:01:54,539 are in, and which hosts are we on, because every 32 00:01:54,539 --> 00:01:57,299 time you are ready to reboot a machine, this is 33 00:01:57,299 --> 00:01:59,129 definitely a command you need to run, which is 34 00:01:59,129 --> 00:02:04,079 hostname, to make sure which computer you are on or 35 00:02:04,079 --> 00:02:07,589 which Linux machine you are on. So anyway, let's 36 00:02:07,589 --> 00:02:11,098 clear the screen. And the first command is 37 00:02:11,098 --> 00:02:15,389 shutdown. Of course, I don't want to shutdown 38 00:02:15,719 --> 00:02:17,729 this machine right now because we're going through 39 00:02:17,729 --> 00:02:19,859 the training. So I'll just quickly go through this 40 00:02:19,859 --> 00:02:23,909 man page of shutdown. And you will see it tells 41 00:02:23,909 --> 00:02:26,999 you shutdown, halt, power-off, or reboot the machine. 42 00:02:27,329 --> 00:02:30,359 shutdown has different options if you want to use 43 00:02:30,389 --> 00:02:34,019 these different options with it. And those options 44 00:02:34,019 --> 00:02:37,199 are listed as you go down. If you type shutdown 45 00:02:37,199 --> 00:02:40,949 -H, it will do exactly the same as 46 00:02:40,949 --> 00:02:44,819 if you would just type halt, and P for power off, 47 00:02:44,849 --> 00:02:47,939 r for reboot, h for equivalent to power off, unless 48 00:02:47,939 --> 00:02:52,049 halt is specified. So you could view every single 49 00:02:52,049 --> 00:02:55,499 options that is available with shutdown. Then we 50 00:02:55,499 --> 00:02:57,451 have the next one is init. 51 00:02:57,451 --> 00:02:59,987 [No audio] 52 00:02:59,987 --> 00:03:03,296 init is a systemd service. 53 00:03:03,296 --> 00:03:06,119 There are different options associated 54 00:03:06,119 --> 00:03:09,929 with init, sorry with, guess with init, and those 55 00:03:09,929 --> 00:03:12,869 options, you can view them one by one. As I said, 56 00:03:13,559 --> 00:03:16,769 there are options zero to seven, you can view 57 00:03:16,769 --> 00:03:21,839 those options and see what exactly they do. Then 58 00:03:21,839 --> 00:03:25,589 we have reboot. reboot simply reboots your 59 00:03:25,589 --> 00:03:31,133 computer, shuts it down, and power off, and bring it back online. 60 00:03:31,133 --> 00:03:33,469 And the last one you have halt. 61 00:03:35,121 --> 00:03:38,519 poweroff, reboot, halt, poweroff. So pretty much all 62 00:03:38,519 --> 00:03:41,609 these commands. You could use any one of these 63 00:03:41,609 --> 00:03:46,769 commands except the reboot command and init command. So 64 00:03:46,769 --> 00:03:50,429 let's say, now we want to reboot our machine. In 65 00:03:50,429 --> 00:03:54,449 order to reboot your machine, you have to be root. 66 00:03:54,449 --> 00:03:57,029 [No audio] 67 00:03:57,029 --> 00:04:01,990 So become root. And if I do reboot, 68 00:04:01,990 --> 00:04:04,042 [No audio] 69 00:04:04,042 --> 00:04:06,359 hit enter. And 70 00:04:06,359 --> 00:04:10,709 you will see I have lost my PuTTY session. And if 71 00:04:10,709 --> 00:04:15,089 you are logged into your console, you'll see the 72 00:04:15,089 --> 00:04:17,279 system message is coming up, this system is going 73 00:04:17,279 --> 00:04:20,819 down. So we'll give it some time. I will fast 74 00:04:20,819 --> 00:04:21,903 forward from here. 75 00:04:21,903 --> 00:04:27,997 [No audio] 76 00:04:27,997 --> 00:04:29,639 Okay, so now I got the prompt 77 00:04:29,639 --> 00:04:32,629 back, the system has been rebooted, I've logged back in. 78 00:04:32,629 --> 00:04:36,776 [No audio] 79 00:04:36,776 --> 00:04:39,899 Now your PuTTY terminal will continue to try 80 00:04:39,899 --> 00:04:43,289 to connect to your system. If it's shut down, it 81 00:04:43,289 --> 00:04:46,019 tries to connect it every second or every five 82 00:04:46,019 --> 00:04:47,819 seconds depending on the setting that you have 83 00:04:47,819 --> 00:04:52,859 specified, and your PuTTY options. So anyway, this 84 00:04:52,859 --> 00:04:56,009 is sweet and simple and straightforward lesson 85 00:04:56,009 --> 00:04:58,979 that we learned about four commands. Try them out 86 00:04:59,009 --> 00:05:00,226 and get familiar with it. 87 00:05:00,226 --> 00:05:02,336 [No audio]