1 00:00:06,450 --> 00:00:07,283 - All right. 2 00:00:07,283 --> 00:00:09,330 So we need man in related to resources, 3 00:00:09,330 --> 00:00:12,510 to find out how to change the hostname of your computer. 4 00:00:12,510 --> 00:00:16,083 Well, I would say let's start with man, 5 00:00:18,180 --> 00:00:20,163 man -k hostname, 6 00:00:21,750 --> 00:00:26,730 which is bringing me a reasonable amount of commands. 7 00:00:26,730 --> 00:00:29,310 That is all almost too easy. 8 00:00:29,310 --> 00:00:33,240 And I can see there's hostname and there's hostnamectl. 9 00:00:33,240 --> 00:00:36,150 hostnamectl, control the system hostname. 10 00:00:36,150 --> 00:00:37,500 That's the one that we need. 11 00:00:37,500 --> 00:00:38,760 So how do we use that? 12 00:00:38,760 --> 00:00:42,540 Well, let's use man on hostnamectl. 13 00:00:42,540 --> 00:00:46,563 And there we get the description of the hostnamectl command. 14 00:00:47,580 --> 00:00:51,000 So does it have any help? 15 00:00:51,000 --> 00:00:52,500 It doesn't have any help? 16 00:00:52,500 --> 00:00:53,940 And if it doesn't have any help 17 00:00:53,940 --> 00:00:56,250 that means that it should be possible 18 00:00:56,250 --> 00:01:01,250 to figure this out in a real easy way for yourself. 19 00:01:01,290 --> 00:01:02,123 And as you can see, 20 00:01:02,123 --> 00:01:05,070 there are options and there is, well, you know what? 21 00:01:05,070 --> 00:01:07,380 I don't feel like reading all of this. 22 00:01:07,380 --> 00:01:12,180 Let's use hostnamectl --help for the quick overview. 23 00:01:12,180 --> 00:01:13,140 Now this is cool. 24 00:01:13,140 --> 00:01:14,400 This is what I need. 25 00:01:14,400 --> 00:01:17,970 And I can see that we have a hostnamectl hostname, 26 00:01:17,970 --> 00:01:22,260 which can be used to get set hostname status. 27 00:01:22,260 --> 00:01:27,030 So, hostnamectl hostname centos 28 00:01:27,030 --> 00:01:30,990 will set the hostname for my current system. 29 00:01:30,990 --> 00:01:33,750 It'll set it for something that it already was. 30 00:01:33,750 --> 00:01:34,583 Does that matter? 31 00:01:34,583 --> 00:01:35,970 No, not really. 32 00:01:35,970 --> 00:01:37,230 What matters is that, you know 33 00:01:37,230 --> 00:01:40,650 that this is how you use hostnamectl. 34 00:01:40,650 --> 00:01:44,130 Then we have the second part of the lab. 35 00:01:44,130 --> 00:01:46,140 Read the help output for ip, 36 00:01:46,140 --> 00:01:48,960 and find how you can bring down a link. 37 00:01:48,960 --> 00:01:53,960 ip --help, is that going to be something useful? 38 00:01:54,240 --> 00:01:57,210 Well, at least it is showing what we can do. 39 00:01:57,210 --> 00:01:58,950 And this is voted number one 40 00:01:58,950 --> 00:02:02,190 most user unfriendly help output. 41 00:02:02,190 --> 00:02:04,380 So let's study, how does this work? 42 00:02:04,380 --> 00:02:05,880 ip OBJECT. 43 00:02:05,880 --> 00:02:07,080 So we have an OBJECT 44 00:02:07,080 --> 00:02:09,690 and the objects are specified right here, 45 00:02:09,690 --> 00:02:11,790 and these are all the objects. 46 00:02:11,790 --> 00:02:14,010 So I need to do something with a link. 47 00:02:14,010 --> 00:02:16,320 Now, look at that, we have ip link. 48 00:02:16,320 --> 00:02:21,090 And then we have a command behind the OBJECT, 49 00:02:21,090 --> 00:02:23,730 well, I don't know which command to work 50 00:02:23,730 --> 00:02:27,510 but ip link --help. 51 00:02:27,510 --> 00:02:30,720 Is it going to bring us any further? 52 00:02:30,720 --> 00:02:32,520 Well, in a certain way it does, 53 00:02:32,520 --> 00:02:35,970 because it's telling me --help is unknown. 54 00:02:35,970 --> 00:02:37,740 Type ip link help. 55 00:02:37,740 --> 00:02:40,200 Okay, let's type ip link help. 56 00:02:40,200 --> 00:02:41,220 And there we go. 57 00:02:41,220 --> 00:02:43,590 And oh boy, oh boy, oh boy. 58 00:02:43,590 --> 00:02:46,740 That is a lot of information. 59 00:02:46,740 --> 00:02:48,750 So let's scroll up a little bit 60 00:02:48,750 --> 00:02:53,130 where we can find ip link set DEVICE up down. 61 00:02:53,130 --> 00:02:55,380 Hey, ip link set DEVICE up down. 62 00:02:55,380 --> 00:02:56,213 Well, what is DEVICE? 63 00:02:56,213 --> 00:02:58,800 DEVICE is your network device. 64 00:02:58,800 --> 00:03:02,370 ip a, as we have seen before, is ens33. 65 00:03:02,370 --> 00:03:06,210 So ens33 is my network device. 66 00:03:06,210 --> 00:03:11,210 ip link down ens33, something like that. 67 00:03:13,170 --> 00:03:14,280 And oh, no. 68 00:03:14,280 --> 00:03:17,553 Command down is unknown. 69 00:03:18,600 --> 00:03:21,510 Command down is unknown? 70 00:03:21,510 --> 00:03:23,220 Did we overlook something? 71 00:03:23,220 --> 00:03:27,030 Well, let's do another ip link help, 72 00:03:27,030 --> 00:03:30,720 and scroll up because for some reason, 73 00:03:30,720 --> 00:03:32,580 the pipe doesn't work here. 74 00:03:32,580 --> 00:03:34,560 And ah, there, I see, I miss it. 75 00:03:34,560 --> 00:03:36,660 ip link set is the command. 76 00:03:36,660 --> 00:03:40,500 So we need ip link set ens33 down. 77 00:03:40,500 --> 00:03:41,880 Let me try again. 78 00:03:41,880 --> 00:03:46,323 ip link set ens33 down. 79 00:03:47,400 --> 00:03:50,370 Uh-oh, operation not permitted. 80 00:03:50,370 --> 00:03:51,360 Do you have anything? 81 00:03:51,360 --> 00:03:52,530 What is going on? 82 00:03:52,530 --> 00:03:53,880 Of course you do. 83 00:03:53,880 --> 00:03:57,120 This requires sudo superpowers. 84 00:03:57,120 --> 00:04:00,390 So let's learn the command again with sudo in front of it. 85 00:04:00,390 --> 00:04:02,880 It's prompting for my sudo password. 86 00:04:02,880 --> 00:04:04,020 And there we go. 87 00:04:04,020 --> 00:04:06,750 At this point, the link is down. 88 00:04:06,750 --> 00:04:10,530 And if I type ip a again, 89 00:04:10,530 --> 00:04:13,984 then right here in the state, we can see that it is down. 90 00:04:13,984 --> 00:04:16,050 Can we bring it up again? 91 00:04:16,050 --> 00:04:18,420 Well, if you remember the output of the help, 92 00:04:18,420 --> 00:04:22,710 there is also ip link set whatever up 93 00:04:22,710 --> 00:04:24,900 to bring the link up again. 94 00:04:24,900 --> 00:04:27,300 And ip a is our final command. 95 00:04:27,300 --> 00:04:28,860 Uh-oh, this is a typo. 96 00:04:28,860 --> 00:04:30,150 And I did this on accident 97 00:04:30,150 --> 00:04:32,250 but it's useful to see this typo. 98 00:04:32,250 --> 00:04:34,890 I used ip a with the back slash behind it. 99 00:04:34,890 --> 00:04:37,890 The back slash means that the Linux shell 100 00:04:37,890 --> 00:04:40,590 expects us to continue on the next line. 101 00:04:40,590 --> 00:04:43,470 So it's opening what we call a secondary prompt. 102 00:04:43,470 --> 00:04:46,530 This > is our secondary prompt, 103 00:04:46,530 --> 00:04:47,760 but I don't wanna be here. 104 00:04:47,760 --> 00:04:49,200 So how do I get out? 105 00:04:49,200 --> 00:04:51,960 Well, CTRL + C is always a good guess. 106 00:04:51,960 --> 00:04:54,150 I'm using CTRL + C to interrupt, 107 00:04:54,150 --> 00:04:58,080 and now I can repeat the command by pressing the Up Arrow, 108 00:04:58,080 --> 00:05:01,170 and we can see that the link is up again. 109 00:05:01,170 --> 00:05:03,480 And that means that we are good. 110 00:05:03,480 --> 00:05:06,240 And that's all that you needed to do for this lab. 111 00:05:06,240 --> 00:05:08,103 Let's continue with the next lesson.