1 00:00:00,430 --> 00:00:01,810 Hello the beautiful people. 2 00:00:01,810 --> 00:00:08,740 And welcome back to our discussion of how to use the nano command line text editor to get your work 3 00:00:08,740 --> 00:00:09,100 done. 4 00:00:09,100 --> 00:00:13,900 So we were in the last video, we were discussing some of the options that Nano has and we discussed 5 00:00:13,900 --> 00:00:19,870 the write out option, the read file option, the where is option, and we got up to the replace option. 6 00:00:19,870 --> 00:00:25,480 So let's actually use the read file option to read in birthday text again. 7 00:00:25,480 --> 00:00:31,120 So we're going to say birthday dot text and you can see that we've got happy birthday read into the 8 00:00:31,120 --> 00:00:31,990 file once again. 9 00:00:31,990 --> 00:00:36,370 And the reason I've done that is so that we can now use the replace command. 10 00:00:36,370 --> 00:00:42,880 And you can see here that the replace command or the replace option here is activated by pressing control 11 00:00:42,880 --> 00:00:44,380 and a backslash. 12 00:00:44,380 --> 00:00:50,290 Now I find the backslash next to the letter Z on my keyboard, but it might be wherever that is on your 13 00:00:50,470 --> 00:00:51,430 on your computer. 14 00:00:51,430 --> 00:00:52,150 On your keyboard. 15 00:00:52,210 --> 00:00:52,540 Okay. 16 00:00:52,600 --> 00:00:59,050 So I'm going to press control and backslash and now it's asking me what I want to replace. 17 00:00:59,050 --> 00:01:06,940 So let's replace birthday and we're going to replace it with code day. 18 00:01:06,940 --> 00:01:13,510 And when I press enter, it's going to now go through each instance of where it found the word birthday 19 00:01:13,570 --> 00:01:15,610 and ask if you want to replace it. 20 00:01:15,610 --> 00:01:18,400 Now you can see down the bottom here, it's going to say, you want to place this instance? 21 00:01:18,400 --> 00:01:25,930 I could say yes, I could say no or I could say all or I could say control and C for cancer. 22 00:01:25,930 --> 00:01:30,040 So let's just press A to make it replace all. 23 00:01:30,640 --> 00:01:35,400 And we see that every instance of birthday has been replaced with the word code day. 24 00:01:35,410 --> 00:01:38,380 So happy code day to you, you beautiful person. 25 00:01:38,650 --> 00:01:40,900 So that's a replacing text. 26 00:01:40,900 --> 00:01:42,220 What about cutting text? 27 00:01:42,220 --> 00:01:43,720 Cutting text is the next one. 28 00:01:43,720 --> 00:01:46,000 So cutting is very easy. 29 00:01:46,000 --> 00:01:48,790 You can see here we've got this line that says Happy Code Day. 30 00:01:48,820 --> 00:01:55,900 If I press control and K to cut that basically deletes the line and if I want to paste that. 31 00:01:56,200 --> 00:02:00,580 So basically it's just like cutting and pasting just in your normal everyday computer use. 32 00:02:00,580 --> 00:02:06,670 So if I want to uncut it, I press control in you and I can do that as many times as I want. 33 00:02:06,670 --> 00:02:09,370 So this is a very, very happy code day. 34 00:02:09,940 --> 00:02:14,770 We can also justify the text using control and j. 35 00:02:14,770 --> 00:02:23,080 So if I press control and J we'll see that the text has been set so that it takes up the full width 36 00:02:23,080 --> 00:02:26,020 of the screen so I can press control in you now to unjustified. 37 00:02:26,050 --> 00:02:29,290 But you can see if I press control and j to justify the text. 38 00:02:29,290 --> 00:02:34,360 The paragraph that I'm in takes up the full width that it can text the full width of the screen. 39 00:02:34,360 --> 00:02:37,120 And for press controlling you, I can justify it. 40 00:02:37,120 --> 00:02:37,960 So that's something to bear in mind. 41 00:02:37,960 --> 00:02:43,990 If you look at control J is justify and before you justify control u is uncut text. 42 00:02:43,990 --> 00:02:48,850 But if I press control and j you see that controlling you has no switch to earn justify. 43 00:02:49,240 --> 00:02:52,630 It tells you here you can now unjustifiably press controlling you. 44 00:02:52,630 --> 00:02:54,460 It goes back to the way that it was. 45 00:02:54,460 --> 00:03:00,400 So up next, we've got the two spell option, which is basically a spell checker. 46 00:03:00,430 --> 00:03:03,850 Now, by default, a spell checker isn't set up for Nano. 47 00:03:03,850 --> 00:03:10,030 So if I press control t it'll say spell checking, failed error invoking spell. 48 00:03:10,060 --> 00:03:10,290 Okay. 49 00:03:10,690 --> 00:03:16,000 What that means is that there's a spell checker not actually set up, but we can set one up. 50 00:03:16,000 --> 00:03:19,300 So let's just save our file by pressing control on O to write it. 51 00:03:19,300 --> 00:03:20,440 Yes, that'll do. 52 00:03:20,440 --> 00:03:25,480 And then press control X to exit and clear the screen with control and l see a lot of keyboard shortcuts 53 00:03:25,480 --> 00:03:26,230 going on here. 54 00:03:26,230 --> 00:03:35,020 So to actually edit the text, the sorry, the spell checker that is used for Nano, that's in the nano 55 00:03:35,020 --> 00:03:42,070 configuration file, which is actually located in our Etsy folder in a file called Nano. 56 00:03:42,070 --> 00:03:46,150 RC So let's open that really ironically with Nano. 57 00:03:46,390 --> 00:03:49,360 So if we do that, here we are, we've now opened our Nano. 58 00:03:49,360 --> 00:03:52,930 RC So it's slash ETSI Slash Nano. 59 00:03:52,930 --> 00:04:01,270 RC So if I show you that graphically where, where we're going, we are in our base directory by going 60 00:04:01,270 --> 00:04:02,380 to other locations and computers. 61 00:04:02,380 --> 00:04:09,250 So this is the slash folder, then you go etsi, so slash etsi, then somewhere in here there'll be 62 00:04:09,250 --> 00:04:11,650 a file called. 63 00:04:11,650 --> 00:04:14,740 No, no, no, no nano RC There it is. 64 00:04:14,740 --> 00:04:15,640 So if we click on Nano. 65 00:04:15,640 --> 00:04:22,870 RC That's basically what we've opened, but let's make sure that we open it in in here. 66 00:04:23,950 --> 00:04:31,240 Actually, at the minute this file is in fact unreadable because we don't have the permissions to edit 67 00:04:31,240 --> 00:04:31,390 it. 68 00:04:31,390 --> 00:04:38,740 So to make that actually editable, we need to do sudo nano slash etsi slash nano RC. 69 00:04:38,980 --> 00:04:43,750 So this pseudo bit basically allows you to run this command as the administrator, but we'll come onto 70 00:04:43,750 --> 00:04:44,560 that a bit more later. 71 00:04:44,560 --> 00:04:45,280 In the course. 72 00:04:45,280 --> 00:04:51,370 You enter your password that you normally use for logging in and now you can edit the file. 73 00:04:52,240 --> 00:04:57,010 Now there's a line in here that has the word a spell or spell in it. 74 00:04:57,010 --> 00:04:59,470 So let's find that by using the where is command. 75 00:04:59,470 --> 00:04:59,950 So let's use the. 76 00:05:00,010 --> 00:05:02,080 Where is Aspell? 77 00:05:02,410 --> 00:05:04,120 Press enter and it found it. 78 00:05:04,540 --> 00:05:09,330 So this line it says here, use this spelling checker instead of the internal one. 79 00:05:09,340 --> 00:05:11,860 This option does not properly have a default value. 80 00:05:12,100 --> 00:05:17,320 So to get rid of that, actually, to make that actually happen, we just need to get rid of this hash 81 00:05:17,320 --> 00:05:19,690 symbol and get rid of the leading space. 82 00:05:19,690 --> 00:05:25,630 So now there's no there's no hash just set speller aspell dash, x dash. 83 00:05:25,630 --> 00:05:26,720 See, just like that. 84 00:05:26,740 --> 00:05:34,090 Now, if we write out and close and now if we go back into Nano for our diary dot text, if we press 85 00:05:34,090 --> 00:05:40,330 control in T to actually start the spell checker, we now have a spell checker working. 86 00:05:40,330 --> 00:05:41,260 So isn't that quite cool? 87 00:05:41,260 --> 00:05:41,440 Right. 88 00:05:41,440 --> 00:05:43,510 We just use Nano to edit Nano. 89 00:05:43,520 --> 00:05:44,250 It's awesome. 90 00:05:44,260 --> 00:05:45,460 So here we are. 91 00:05:45,460 --> 00:05:48,100 It's going through our spell check and it's telling me my name is wrong. 92 00:05:48,400 --> 00:05:49,750 Well, that's charming, isn't it? 93 00:05:50,110 --> 00:05:50,650 But there you go. 94 00:05:50,650 --> 00:05:55,630 That's how you can actually go about setting up your spell checker and you can just enter things in 95 00:05:55,630 --> 00:05:55,780 here. 96 00:05:55,780 --> 00:06:02,350 So if I wanted to change my name to, let's say Yoda, which of course I do, because that's totally 97 00:06:02,350 --> 00:06:02,880 awesome. 98 00:06:02,890 --> 00:06:09,510 I just enter five and you see that my name is now Yoda and it's a fact because it's on a video. 99 00:06:09,520 --> 00:06:13,690 Okay, so if I now I can also close into any of these options. 100 00:06:13,690 --> 00:06:19,660 You can ignore, replace, add to dictionary, replace all or ignore all or whatever it might be, but 101 00:06:19,660 --> 00:06:23,080 let's just press X to exit and there we are. 102 00:06:23,080 --> 00:06:24,220 We're back into normal stuff. 103 00:06:24,220 --> 00:06:29,440 So once you've edited that, all you've got to do wouldn't you do that so that your spell checker works? 104 00:06:30,070 --> 00:06:30,850 You're good to go. 105 00:06:30,850 --> 00:06:36,040 And it is possible to to also add different dictionaries and stuff like that as well. 106 00:06:36,040 --> 00:06:39,730 And you can find that information online as well. 107 00:06:39,760 --> 00:06:40,110 Okay. 108 00:06:40,240 --> 00:06:41,290 So there we are. 109 00:06:41,290 --> 00:06:46,780 That's how you do spell checking and a control in C is apparently tells you your current position. 110 00:06:46,780 --> 00:06:52,720 So if I press control and C, it'll tell us I'm online one out of 19 5% of the way through column one 111 00:06:52,720 --> 00:06:55,780 out of 17 and character zero out of 275. 112 00:06:55,780 --> 00:07:00,310 So if I move over here now and I press control and see, that will change. 113 00:07:00,310 --> 00:07:02,770 I'm now on line seven, column ten and stuff like that. 114 00:07:02,770 --> 00:07:03,820 So this is this is good. 115 00:07:04,030 --> 00:07:09,580 If you are working on a file and you want to give it to someone and you say, Oh, hey, can you change 116 00:07:09,580 --> 00:07:11,650 this file at this given position? 117 00:07:11,650 --> 00:07:16,660 Or you're giving people instructions on how to use a file and you say on line seven, in column 11, 118 00:07:16,900 --> 00:07:18,100 change this text. 119 00:07:18,520 --> 00:07:23,050 So, in fact, just to show you let me let me actually save that. 120 00:07:23,050 --> 00:07:23,620 Yes. 121 00:07:24,250 --> 00:07:33,400 If I go to edit our slash etsi slash nano RC file and I can search for where is that a spell? 122 00:07:33,580 --> 00:07:34,990 Now, I can tell you here we are. 123 00:07:34,990 --> 00:07:36,010 I'm on a spell. 124 00:07:36,010 --> 00:07:41,170 And if I press control and see, I can see here that I'm on line 172. 125 00:07:41,170 --> 00:07:45,250 So if you want to set your spell checker, go to line 172. 126 00:07:45,250 --> 00:07:47,950 And that's the line that you need to edit, for example. 127 00:07:47,950 --> 00:07:49,090 That would be one way to do it, right? 128 00:07:49,090 --> 00:07:52,330 So I can close that, get back into diary dot text. 129 00:07:52,330 --> 00:07:53,290 Now we're getting through. 130 00:07:53,320 --> 00:07:59,140 The next option is control and underscore and that allows us to go to a line. 131 00:07:59,620 --> 00:08:05,890 So if I press control and underscore and press control and underscore, oh, sorry, I'm pressing the 132 00:08:05,890 --> 00:08:06,670 wrong button here. 133 00:08:06,670 --> 00:08:07,960 Oh, there we go. 134 00:08:07,960 --> 00:08:10,240 Because underscore is in a bit of a weird position on my computer. 135 00:08:10,240 --> 00:08:13,900 So I press control and underscore and it says, enter the line number and column number. 136 00:08:13,900 --> 00:08:17,380 So let's go to line ten, column two. 137 00:08:17,710 --> 00:08:18,340 And there we are. 138 00:08:18,340 --> 00:08:23,590 I'm in line ten column to see if I can actually get this stuff to get a bit bigger. 139 00:08:23,590 --> 00:08:23,950 There we go. 140 00:08:23,950 --> 00:08:25,030 I've made the font a bit bigger. 141 00:08:25,660 --> 00:08:31,900 So Control Underscore done it because I have to press control and shift and underscore. 142 00:08:31,930 --> 00:08:33,610 There we go on mine anyway. 143 00:08:33,610 --> 00:08:36,700 So so now you can enter a line number and column number. 144 00:08:36,700 --> 00:08:39,130 So let's say line nine, column 12. 145 00:08:39,429 --> 00:08:40,150 There we go. 146 00:08:40,150 --> 00:08:41,230 We are in line nine, column 12. 147 00:08:41,230 --> 00:08:43,630 And columns aren't separated by spaces. 148 00:08:43,630 --> 00:08:45,040 They're separated by letters. 149 00:08:45,070 --> 00:08:46,180 Okay, so here we are. 150 00:08:46,180 --> 00:08:46,690 Here's column. 151 00:08:46,690 --> 00:08:51,010 One, two, three, four, five, six, seven, eight, nine, ten, 11, 12. 152 00:08:51,330 --> 00:08:55,150 And that's that's where we this way we might get to if we went to column 12 on whatever line. 153 00:08:55,150 --> 00:09:05,020 So if I said to you, let's edit our slash Etsy slash RC file and I looked for using using the where 154 00:09:05,020 --> 00:09:10,810 is command I do control W and I search for a spell and I get to this line. 155 00:09:10,810 --> 00:09:14,350 I'm like, ha, where is this line control in C which is current position. 156 00:09:14,350 --> 00:09:16,520 It says line 172. 157 00:09:17,020 --> 00:09:23,740 So now on your computer, when you open the file, you be like, ha, z says line 172. 158 00:09:23,740 --> 00:09:30,730 So press control and underscore enter line 172 Press Enter. 159 00:09:30,730 --> 00:09:35,560 And I've ended up at the correct line, so you can see how useful that might be if you're collaborating 160 00:09:35,560 --> 00:09:36,700 on something with someone. 161 00:09:36,700 --> 00:09:40,060 So let's get back into our diary text. 162 00:09:40,720 --> 00:09:43,270 We've then got undo and redo. 163 00:09:43,270 --> 00:09:51,910 So if I for example, cut out all these things here and then I was like, Oh, I don't want that to 164 00:09:51,910 --> 00:09:53,080 happen, let me undo. 165 00:09:53,110 --> 00:09:57,460 You can see I just undo and it undid all those delete things. 166 00:09:57,460 --> 00:09:59,710 I could also press alt and E. 167 00:09:59,820 --> 00:10:05,370 And remember, this could be escape or command depending on your keyboard layout, just the modify key, 168 00:10:05,370 --> 00:10:06,600 whatever that is for you. 169 00:10:06,870 --> 00:10:14,010 On my keyboard it's alt, but if I press alt and e that should redo alter new undo redo oops. 170 00:10:15,150 --> 00:10:18,090 Alternate E alter new. 171 00:10:18,390 --> 00:10:18,720 Yeah. 172 00:10:18,720 --> 00:10:20,910 Yeah, I've broke it now, but you get the point. 173 00:10:21,510 --> 00:10:27,690 So, so that's how you can undo and redo stuff and instead of cutting because you see here, if I cut 174 00:10:27,720 --> 00:10:33,150 now I can uncut instead of cutting you can actually just directly copy. 175 00:10:33,150 --> 00:10:36,420 So here you've just got to do alt and the number six. 176 00:10:36,420 --> 00:10:41,760 So if I press alter the number six now I can press control and you and I'll start pasting. 177 00:10:41,760 --> 00:10:48,480 So maybe if I, if I do it here alternate six and then press controlling you, now I'm copying and pasting 178 00:10:48,480 --> 00:10:49,320 just like that. 179 00:10:49,770 --> 00:10:56,040 So that saves you from actually cutting and mark text as far as I've seen or I don't use that one very 180 00:10:56,040 --> 00:11:00,030 often, but as far as I can tell, all that does is allow you to highlight stuff. 181 00:11:00,030 --> 00:11:04,620 So yeah, just it just kind of allows you to highlight stuff. 182 00:11:04,620 --> 00:11:06,480 So there we go. 183 00:11:06,750 --> 00:11:10,890 That's basically everything you need to know about using the nano command. 184 00:11:12,490 --> 00:11:14,020 So there you are, you beautiful people. 185 00:11:14,020 --> 00:11:18,850 In the last couple of videos you've become very familiar with using the nano command line based text 186 00:11:18,850 --> 00:11:19,270 editor. 187 00:11:19,300 --> 00:11:24,400 Now, the benefit of using a command line based text editor such as Nano is that you can get all of 188 00:11:24,400 --> 00:11:28,840 your work done without leaving the command line, which basically maximizes your productivity. 189 00:11:28,870 --> 00:11:36,550 It command line editors have lower resource requirements than graphical equivalent, so you don't need 190 00:11:36,550 --> 00:11:39,460 as much hardware usage in order to actually run them. 191 00:11:39,460 --> 00:11:43,510 And also, if you were remote administering something like a server, the techniques you've learned 192 00:11:43,510 --> 00:11:48,700 here would still work because Nano basically comes with every version of Linux, at least the most common 193 00:11:48,700 --> 00:11:49,460 ones anyway. 194 00:11:49,480 --> 00:11:54,640 So you've learnt how to use Nano and we've looked at a lot of keyboard shortcut options and you saw 195 00:11:54,640 --> 00:11:57,460 how to use pretty much all of those. 196 00:11:57,610 --> 00:11:59,260 So you don't have to memorize them. 197 00:11:59,260 --> 00:12:00,150 Don't worry about that. 198 00:12:00,160 --> 00:12:01,990 Now you've got a bit of an idea about how they work. 199 00:12:02,110 --> 00:12:03,880 Honestly, Nano is just a text editor. 200 00:12:03,880 --> 00:12:07,840 You can just type text in there, you can write code in there, whatever you want to do. 201 00:12:09,160 --> 00:12:14,830 You can edit files in there, but just bear in mind that the tools, the options in there are accessed 202 00:12:14,830 --> 00:12:16,180 using keyboard shortcuts. 203 00:12:16,180 --> 00:12:19,780 So if you see this little hat, then that means the control key. 204 00:12:19,780 --> 00:12:26,470 And if you see M minus, that's either the alt escape or command keys on your keyboard depending upon 205 00:12:26,470 --> 00:12:26,920 your layout. 206 00:12:26,920 --> 00:12:27,700 Just try them out. 207 00:12:27,730 --> 00:12:29,710 See which one works on your keyboard layout. 208 00:12:29,980 --> 00:12:31,000 On mine it was alt. 209 00:12:31,000 --> 00:12:32,110 It might be different on yours. 210 00:12:32,110 --> 00:12:37,960 And you also saw that you can edit how Nano works by editing its configuration file, which is located 211 00:12:37,960 --> 00:12:41,140 at slash ETSI Slash Nano RC. 212 00:12:41,140 --> 00:12:44,410 So a lot of this stuff is going to be probably for reference for you. 213 00:12:44,410 --> 00:12:48,070 So you've got it here in this video, in this course to refer back to later on if you ever want to look 214 00:12:48,070 --> 00:12:48,670 anything up. 215 00:12:48,670 --> 00:12:50,530 But really nano is very simple to use. 216 00:12:50,530 --> 00:12:54,820 You just type nano, then the command, then the file name that you want to edit and you can just go 217 00:12:54,820 --> 00:12:56,350 and edit it like any other text file. 218 00:12:56,350 --> 00:12:57,070 So there you are. 219 00:12:57,100 --> 00:12:58,990 You now know how to edit files from the command line. 220 00:12:58,990 --> 00:13:03,160 It should be feeling quite a lot more like a computer wizard at this point. 221 00:13:03,160 --> 00:13:08,230 So with all this super awesome file creation, moving, copying and pasting and editing that you'll 222 00:13:08,230 --> 00:13:12,400 be doing, it's possible that you might want to find where certain important configuration files are 223 00:13:12,400 --> 00:13:16,000 located so that you can edit them or wear that file that you created has run off to. 224 00:13:16,000 --> 00:13:19,030 But you don't want to have to go through each folder manually to look for them. 225 00:13:19,030 --> 00:13:23,740 So in the next video you're going to learn how to search for files anywhere on your system using the 226 00:13:23,740 --> 00:13:24,760 Locate Command. 227 00:13:24,760 --> 00:13:27,670 Now, the Locate Command is one of my favorites and I can't wait to show you. 228 00:13:27,670 --> 00:13:30,910 So for all that good stuff, I'll see you in the next video.