1 00:00:23,170 --> 00:00:24,190 DAVID MALAN: All right. 2 00:00:24,190 --> 00:00:27,670 This is CS50's Introduction to Programming with Python. 3 00:00:27,670 --> 00:00:30,010 My name is David Malan and this is an introduction 4 00:00:30,010 --> 00:00:32,500 to Visual Studio Code for CS50. 5 00:00:32,500 --> 00:00:35,800 Visual Studio Code, or VS Code, is a very popular program 6 00:00:35,800 --> 00:00:37,430 nowadays for writing code. 7 00:00:37,430 --> 00:00:39,970 It's technically a text editor, or nowadays really 8 00:00:39,970 --> 00:00:42,710 an IDE, an Integrated Development Environment, 9 00:00:42,710 --> 00:00:44,650 which means it's a program that's designed 10 00:00:44,650 --> 00:00:48,580 for enabling you efficiently and effectively to write code 11 00:00:48,580 --> 00:00:49,580 in your computer. 12 00:00:49,580 --> 00:00:53,110 Now it turns out you typically install VS Code on your own Mac or PC. 13 00:00:53,110 --> 00:00:55,390 It's free, open source software, which means anyone 14 00:00:55,390 --> 00:00:57,160 can download it on their own computer. 15 00:00:57,160 --> 00:00:59,650 But typically, when installing it on your own computer, 16 00:00:59,650 --> 00:01:02,620 particularly to use for programming with a language like Python, 17 00:01:02,620 --> 00:01:04,370 there's a few other steps as well. 18 00:01:04,370 --> 00:01:06,470 You need to install support for Python itself, 19 00:01:06,470 --> 00:01:09,220 you might need to configure some of the lower level implementation 20 00:01:09,220 --> 00:01:11,470 details of your computer just so that things work. 21 00:01:11,470 --> 00:01:15,280 And so instead, for this course, we recommend that you use VS Code, yes, 22 00:01:15,280 --> 00:01:19,450 but you use it in the cloud by way of CS50's own implementation 23 00:01:19,450 --> 00:01:22,450 thereof on top of something called GitHub Code Spaces, which 24 00:01:22,450 --> 00:01:24,220 is a hosted version of the same. 25 00:01:24,220 --> 00:01:28,930 To use Visual Studio Code for CS50, go to code.cs50.io 26 00:01:28,930 --> 00:01:32,410 where you'll be prompted to log in with your free github.com account. 27 00:01:32,410 --> 00:01:34,390 After some number of seconds or minutes, you'll 28 00:01:34,390 --> 00:01:37,360 then be redirected to your so-called code space, which 29 00:01:37,360 --> 00:01:39,430 is your own virtual space in the cloud. 30 00:01:39,430 --> 00:01:41,860 Somewhere out there on GitHub servers, you 31 00:01:41,860 --> 00:01:43,930 will have access to your own storage space, 32 00:01:43,930 --> 00:01:46,420 really your own hard drive in the cloud in which you 33 00:01:46,420 --> 00:01:50,590 can create files, run programs, and even organize everything in folders. 34 00:01:50,590 --> 00:01:54,980 You'll also have the ability to write code via that interface and much more. 35 00:01:54,980 --> 00:01:57,670 The interface you'll see typically looks a little something 36 00:01:57,670 --> 00:02:01,720 like this, whereby you'll have at the top left hand of your screen 37 00:02:01,720 --> 00:02:04,930 a File Explorer that allows you to see all of the files you've 38 00:02:04,930 --> 00:02:07,430 created over time in your account. 39 00:02:07,430 --> 00:02:10,120 You'll then have the ability at the top to actually write code 40 00:02:10,120 --> 00:02:13,340 by creating one or more tabs in which to write your programs. 41 00:02:13,340 --> 00:02:16,300 And then perhaps less familiarly, at the bottom of the screen, 42 00:02:16,300 --> 00:02:19,240 you're going to have access to what's called a terminal window. 43 00:02:19,240 --> 00:02:22,510 A terminal window is a command line interface, 44 00:02:22,510 --> 00:02:25,330 or CLI, which is very much in contrast with what 45 00:02:25,330 --> 00:02:27,400 you and I are mostly familiar with nowadays, 46 00:02:27,400 --> 00:02:30,040 which is a graphical user interface, or GUI. 47 00:02:30,040 --> 00:02:32,619 Indeed, everything we're seeing here is graphical by nature. 48 00:02:32,619 --> 00:02:34,900 There's buttons, and icons, and windows, and more. 49 00:02:34,900 --> 00:02:37,810 But underneath the hood, you actually have access 50 00:02:37,810 --> 00:02:40,900 not only to your own virtual hard drive in the cloud, but actually 51 00:02:40,900 --> 00:02:42,490 your own server too. 52 00:02:42,490 --> 00:02:46,420 Somewhere out there on GitHub servers is your own server 53 00:02:46,420 --> 00:02:49,180 in a sense, your own virtual server, or technically called 54 00:02:49,180 --> 00:02:52,240 a container, in which all of your own files will live. 55 00:02:52,240 --> 00:02:56,200 You then have the ability to create files, run programs, even install 56 00:02:56,200 --> 00:02:59,770 additional software within that server, or that container, 57 00:02:59,770 --> 00:03:03,430 because that server container is itself running its own operating system. 58 00:03:03,430 --> 00:03:05,470 And the operating system it's running is not 59 00:03:05,470 --> 00:03:08,200 Mac OS or Windows with which you're probably familiar, 60 00:03:08,200 --> 00:03:11,350 but another popular operating system called Linux. 61 00:03:11,350 --> 00:03:14,770 And Linux is used by so many programmers and more nowadays 62 00:03:14,770 --> 00:03:18,680 not only to write code, but to run it, on their own servers as well. 63 00:03:18,680 --> 00:03:22,330 So how can you go about leveraging this new command line interface? 64 00:03:22,330 --> 00:03:24,670 Well, it's worth learning just a few commands 65 00:03:24,670 --> 00:03:26,620 that you might not have typed previously. 66 00:03:26,620 --> 00:03:29,950 These commands work not only in Linux, but also on Mac OS, 67 00:03:29,950 --> 00:03:34,040 and also with some modification potentially on Windows as well. 68 00:03:34,040 --> 00:03:39,490 But if you're using Visual Studio Code for CS50 in the cloud at code.cs50.io, 69 00:03:39,490 --> 00:03:42,650 you'll have the ability to run all these commands and more. 70 00:03:42,650 --> 00:03:45,730 And here is just a few of those that you can type. 71 00:03:45,730 --> 00:03:49,690 I'm going to go ahead now and type code, which actually is a command that comes 72 00:03:49,690 --> 00:03:53,800 with VS Code itself, that enables me to create new files and open new tabs. 73 00:03:53,800 --> 00:03:56,350 I'm going to change screens over to my own computer 74 00:03:56,350 --> 00:04:00,490 here in which I have full screen VS Code for CS50. 75 00:04:00,490 --> 00:04:03,250 So this is my browser window full screened 76 00:04:03,250 --> 00:04:07,360 connected to my own code space, my virtual container, in the cloud. 77 00:04:07,360 --> 00:04:10,450 And suppose that I want to go ahead and create my own first program 78 00:04:10,450 --> 00:04:13,660 called hello.py, a program written in Python. 79 00:04:13,660 --> 00:04:19,030 In my terminal window, I could type code hello.py and hit Enter. 80 00:04:19,030 --> 00:04:23,140 But before I do, notice at top left in my so-called File Explorer, 81 00:04:23,140 --> 00:04:24,700 there's technically nothing there. 82 00:04:24,700 --> 00:04:28,540 There's some mention of code spaces and some mention of my own unique ID. 83 00:04:28,540 --> 00:04:31,210 But there's no actual files or folders there yet. 84 00:04:31,210 --> 00:04:35,200 But when I hit Enter, thereby creating a new file called hello.py, 85 00:04:35,200 --> 00:04:37,840 I'm not only going to see it appear in just a moment in a tab 86 00:04:37,840 --> 00:04:41,410 where I can edit it, I'm also going to see a graphical representation of it 87 00:04:41,410 --> 00:04:44,860 up here, which is only to say that this environment, this integrated 88 00:04:44,860 --> 00:04:47,080 environment, all works cohesively. 89 00:04:47,080 --> 00:04:47,860 Here we go. 90 00:04:47,860 --> 00:04:48,700 Hitting Enter. 91 00:04:48,700 --> 00:04:52,330 My tab has opened, my prompt is blinking here, so I can start writing code. 92 00:04:52,330 --> 00:04:55,840 But you'll also see that hello.py not only exists, but is 93 00:04:55,840 --> 00:04:58,630 highlighted as the file I've opened. 94 00:04:58,630 --> 00:05:01,210 Well, let me go ahead and write a very simple program now. 95 00:05:01,210 --> 00:05:05,080 Print quote unquote in parentheses, hello comma world, 96 00:05:05,080 --> 00:05:07,390 which as you'll see if not already is perhaps 97 00:05:07,390 --> 00:05:09,880 the most formative, most canonical program 98 00:05:09,880 --> 00:05:13,732 you can write first when writing code in most any language. 99 00:05:13,732 --> 00:05:15,940 I'm going to go ahead now, and in my terminal window, 100 00:05:15,940 --> 00:05:17,890 I'm going to run one other command that you'll 101 00:05:17,890 --> 00:05:19,870 learn all the more about soon too. 102 00:05:19,870 --> 00:05:22,990 I'm going to run Python itself, which is not only a language, 103 00:05:22,990 --> 00:05:26,270 it's actually a program that understands that language. 104 00:05:26,270 --> 00:05:30,250 And if I specify not just Python but a space, and the name of a file 105 00:05:30,250 --> 00:05:33,880 that I have created containing code written in that language, 106 00:05:33,880 --> 00:05:39,310 crossing my fingers as always and hit Enter, I've just run my own program. 107 00:05:39,310 --> 00:05:43,000 Now on our Macs and PCs, we're generally in the habit of pointing and double 108 00:05:43,000 --> 00:05:47,050 clicking on icons or on our phones, tapping on icons to launch some file 109 00:05:47,050 --> 00:05:47,950 or program. 110 00:05:47,950 --> 00:05:52,630 In a command line interface, or CLI, everything is done with the keyboard. 111 00:05:52,630 --> 00:05:55,840 You can use your mouse to move your cursor up and down as needed. 112 00:05:55,840 --> 00:05:58,150 But generally, you do everything with your keyboard, 113 00:05:58,150 --> 00:05:59,770 not really with your mouse. 114 00:05:59,770 --> 00:06:02,360 Everything else on the screen can be clicked on. 115 00:06:02,360 --> 00:06:04,240 But in your terminal window, you'll generally 116 00:06:04,240 --> 00:06:07,240 see this prompt, a single dollar sign that does not mean 117 00:06:07,240 --> 00:06:09,470 dollar or currency for that matter. 118 00:06:09,470 --> 00:06:12,640 It's just a standard symbol that means type your commands here. 119 00:06:12,640 --> 00:06:15,937 And it's a visual indicator that you can type your next command. 120 00:06:15,937 --> 00:06:17,770 And indeed, the two commands I've thus typed 121 00:06:17,770 --> 00:06:21,130 are code to create my new file within VS Code itself, 122 00:06:21,130 --> 00:06:26,050 and then Python, which we, CS50, already pre-installed into your code space 123 00:06:26,050 --> 00:06:31,130 so that you have built in support from day one with writing your own code. 124 00:06:31,130 --> 00:06:33,460 Now there's other things I can do in this environment. 125 00:06:33,460 --> 00:06:36,640 I, for instance, could control click, or right click up here, 126 00:06:36,640 --> 00:06:40,480 and see a whole menu of options with which to edit, or modify, 127 00:06:40,480 --> 00:06:42,940 that file, just on Mac OS or Windows. 128 00:06:42,940 --> 00:06:46,000 I could click on some of these icons at top left, the plus icon 129 00:06:46,000 --> 00:06:47,960 to create a new file or a new folder. 130 00:06:47,960 --> 00:06:51,910 So all of those GUI conventions, Graphical User Interface conventions, 131 00:06:51,910 --> 00:06:52,870 are still there. 132 00:06:52,870 --> 00:06:56,350 But you will and should get more comfortable over time with the command 133 00:06:56,350 --> 00:07:01,160 line interface alone, which does all of those things and more for you. 134 00:07:01,160 --> 00:07:05,260 In fact, here are just a few more of the commands that you can use within Linux, 135 00:07:05,260 --> 00:07:07,480 and this command line interface specifically. 136 00:07:07,480 --> 00:07:10,960 We'll see in a moment LS, which allows you to list all of the files 137 00:07:10,960 --> 00:07:15,790 in your current folder, CP, which will allow you to copy a file from one place 138 00:07:15,790 --> 00:07:18,850 to another, MV, which will allow you to move a file 139 00:07:18,850 --> 00:07:22,910 or really rename it from one name to another, RM for remove, 140 00:07:22,910 --> 00:07:27,280 which will allow you to delete a file, dir, sir, MKDIR, which will allow you 141 00:07:27,280 --> 00:07:32,110 to make a directory, that is a folder, CD, which will allow you to change 142 00:07:32,110 --> 00:07:35,530 directories from one folder to another, rmdir, 143 00:07:35,530 --> 00:07:38,025 which will allow you to remove a directory, and then clear, 144 00:07:38,025 --> 00:07:40,900 which will just aesthetically clear your terminal window, if like me, 145 00:07:40,900 --> 00:07:43,270 you like to keep things a little bit tidy. 146 00:07:43,270 --> 00:07:45,760 Now these are just some of the commands you can 147 00:07:45,760 --> 00:07:47,980 type within Linux at this command line. 148 00:07:47,980 --> 00:07:51,190 But they're really equivalent to all the kinds of things you and I already 149 00:07:51,190 --> 00:07:54,430 do frequently on our own Macs or PCs. 150 00:07:54,430 --> 00:07:56,140 Let me go back to VS Code here. 151 00:07:56,140 --> 00:07:58,390 And let's just try out a few of these here. 152 00:07:58,390 --> 00:08:00,407 I'm going to go ahead and first clear my screen 153 00:08:00,407 --> 00:08:01,990 as though we're starting from scratch. 154 00:08:01,990 --> 00:08:04,810 But this doesn't change or delete any of my files. 155 00:08:04,810 --> 00:08:06,730 It just clears my terminal window. 156 00:08:06,730 --> 00:08:10,420 I can alternatively hit Control L to do the exact same. 157 00:08:10,420 --> 00:08:12,430 Now I'm going to go ahead and type LS. 158 00:08:12,430 --> 00:08:16,150 But before I hit Enter, note that LS kind of sounds like list. 159 00:08:16,150 --> 00:08:19,600 And indeed, this command and almost all of those others were fairly succinct 160 00:08:19,600 --> 00:08:25,510 in that LS means list, but you only type the L and the S, no L-I-S-T. 161 00:08:25,510 --> 00:08:28,120 And this is true of a lot of command line interface commands, 162 00:08:28,120 --> 00:08:31,300 just to enable you and I to type things more quickly, 163 00:08:31,300 --> 00:08:36,100 a lot of these commands have this very succinct syntax in names. 164 00:08:36,100 --> 00:08:36,940 So here we go. 165 00:08:36,940 --> 00:08:38,380 I've typed out LS already. 166 00:08:38,380 --> 00:08:39,970 I'm going to go ahead and hit Enter. 167 00:08:39,970 --> 00:08:43,120 And you'll see only one thing, hello.py, which 168 00:08:43,120 --> 00:08:47,020 is to say when I try to list all of the files in my current default folder 169 00:08:47,020 --> 00:08:50,440 that just automatically opens when I launch VS Code in the cloud, 170 00:08:50,440 --> 00:08:54,280 I only see the one file exists, which I can also see graphically here. 171 00:08:54,280 --> 00:08:56,510 Well, let me go ahead now and do something else. 172 00:08:56,510 --> 00:08:58,390 Let's make a copy of this file and call it, 173 00:08:58,390 --> 00:09:02,500 goodbye.py just so in anticipation of writing a second program that says 174 00:09:02,500 --> 00:09:04,270 goodbye, world instead of hello. 175 00:09:04,270 --> 00:09:09,070 I'm going to do CP for copy, then the first name of the file, hello.py, then 176 00:09:09,070 --> 00:09:14,350 a space, and then the new name for the new file, goodbye.py, Enter. 177 00:09:14,350 --> 00:09:16,233 And now notice nothing really has happened. 178 00:09:16,233 --> 00:09:17,650 And that's generally a good thing. 179 00:09:17,650 --> 00:09:20,560 If you don't see an error message down here, you've done well. 180 00:09:20,560 --> 00:09:24,640 But you do see graphically up here that both files now exist. 181 00:09:24,640 --> 00:09:27,680 Now I could open goodbye.py in a couple of ways. 182 00:09:27,680 --> 00:09:30,700 I could actually just go up here and double click on goodbye.py 183 00:09:30,700 --> 00:09:31,720 to open it here. 184 00:09:31,720 --> 00:09:36,250 Or I can type the same command as earlier, code of goodbye.py, 185 00:09:36,250 --> 00:09:38,470 and now I'll have a second tab open here. 186 00:09:38,470 --> 00:09:41,050 And for parallelism, I could change this word 187 00:09:41,050 --> 00:09:44,380 from hello to goodbye just so I have a second program 188 00:09:44,380 --> 00:09:47,480 now that it is indeed the second file as well. 189 00:09:47,480 --> 00:09:50,260 Now what if I decide that I don't want this file? 190 00:09:50,260 --> 00:09:53,260 And I'm going to go ahead and close it here and I want to rename it 191 00:09:53,260 --> 00:09:54,610 and change it to-- 192 00:09:54,610 --> 00:09:57,730 from goodbye.py to farewell.py. 193 00:09:57,730 --> 00:10:00,260 Well, it still says goodbye.py up here. 194 00:10:00,260 --> 00:10:03,670 And if I type LS down here, I'll see a list of two files now 195 00:10:03,670 --> 00:10:05,210 that are in that same folder. 196 00:10:05,210 --> 00:10:09,640 Let me do MV for move, goodbye.py, and then something 197 00:10:09,640 --> 00:10:11,710 like farewell.py instead. 198 00:10:11,710 --> 00:10:12,370 Enter. 199 00:10:12,370 --> 00:10:14,780 And you'll see that it changed up here at left. 200 00:10:14,780 --> 00:10:19,007 And if I type LS again, you'll see that it changed down here as well. 201 00:10:19,007 --> 00:10:19,840 Well, you know what? 202 00:10:19,840 --> 00:10:21,340 Let's never mind with farewell.py. 203 00:10:21,340 --> 00:10:24,050 Let's go ahead and just remove this I'll altogether. 204 00:10:24,050 --> 00:10:26,990 I could go up here and single click on farewell.py 205 00:10:26,990 --> 00:10:31,820 in my File Explorer, control click, or right click, and then select Delete. 206 00:10:31,820 --> 00:10:35,180 Or down here on my command line interface, I could do this. 207 00:10:35,180 --> 00:10:37,850 I could do RM space farewell. 208 00:10:37,850 --> 00:10:41,450 And now notice if I'm a little tired of typing out these long file names, 209 00:10:41,450 --> 00:10:45,080 Linux and command line interfaces frequently support autocomplete. 210 00:10:45,080 --> 00:10:48,710 So instead of typing farewell, I'm going to type FAR, 211 00:10:48,710 --> 00:10:50,780 which sounds like more than enough characters 212 00:10:50,780 --> 00:10:52,460 to finish the rest of my thought. 213 00:10:52,460 --> 00:10:54,870 And I'm going to hit Tab on my keyboard. 214 00:10:54,870 --> 00:10:58,550 And it just finishes it for me without having to manually type the same. 215 00:10:58,550 --> 00:11:00,050 I'm going to go ahead and hit Enter. 216 00:11:00,050 --> 00:11:03,410 And I'll see a somewhat cryptic message now, as many of them admittedly are. 217 00:11:03,410 --> 00:11:04,320 It's not an error. 218 00:11:04,320 --> 00:11:05,390 It's just a prompt. 219 00:11:05,390 --> 00:11:08,840 Remove regular file quote unquote, "farewell.py". 220 00:11:08,840 --> 00:11:13,070 This is just a safety check to make sure that I'm OK with deleting this file. 221 00:11:13,070 --> 00:11:15,560 Generally when prompted with a question like this, 222 00:11:15,560 --> 00:11:19,280 go ahead and type in Y for yes, or N for no. 223 00:11:19,280 --> 00:11:20,300 And hit Enter. 224 00:11:20,300 --> 00:11:23,420 And now nothing bad seems to have happened in terms of any messages. 225 00:11:23,420 --> 00:11:27,550 But indeed, farewell.py is now gone. 226 00:11:27,550 --> 00:11:29,230 Well, what more can we now do? 227 00:11:29,230 --> 00:11:31,900 Let me clear up the screen just for aesthetics sake here. 228 00:11:31,900 --> 00:11:35,020 And let's create one or more folders, not just files. 229 00:11:35,020 --> 00:11:38,290 Let me go ahead and make a directory here with MKdir. 230 00:11:38,290 --> 00:11:41,890 And let me just call it folder, though I could call it anything I want. 231 00:11:41,890 --> 00:11:44,860 Alternatively, I could go up here to my File Explorer, 232 00:11:44,860 --> 00:11:47,350 click on the plus icon here on the folder, 233 00:11:47,350 --> 00:11:49,670 and manually create a no folder as well. 234 00:11:49,670 --> 00:11:53,960 But here again, the goal is to focus on this command line interface instead. 235 00:11:53,960 --> 00:11:54,460 All right. 236 00:11:54,460 --> 00:11:56,890 MKdir folder and hit Enter. 237 00:11:56,890 --> 00:11:59,450 Nothing seems to happen in the way of error messages. 238 00:11:59,450 --> 00:12:01,540 But now, notice there's not just hello.py, 239 00:12:01,540 --> 00:12:04,810 but a folder, or directory, called folder. 240 00:12:04,810 --> 00:12:06,890 Well, what now can I do with that? 241 00:12:06,890 --> 00:12:08,890 Well, let me go ahead and see what's inside. 242 00:12:08,890 --> 00:12:11,237 Well, in my GUI, my Graphical User Interface, 243 00:12:11,237 --> 00:12:14,320 I could click on the folder here in this little triangle, and look inside. 244 00:12:14,320 --> 00:12:17,362 And of course, there's nothing there because I literally just created it. 245 00:12:17,362 --> 00:12:19,600 But let me do this now in my terminal window. 246 00:12:19,600 --> 00:12:21,910 Let me type LS after clicking down here. 247 00:12:21,910 --> 00:12:25,840 And we'll see both my folder, which by convention has a slash at the end 248 00:12:25,840 --> 00:12:28,510 to make visually clear that it's a folder, not a file, 249 00:12:28,510 --> 00:12:30,070 and there's hello.py. 250 00:12:30,070 --> 00:12:32,320 Let me go ahead now and change directory. 251 00:12:32,320 --> 00:12:35,200 Now in Mac OS or Windows, we would again just click or double click 252 00:12:35,200 --> 00:12:36,940 on the folder and see what's inside. 253 00:12:36,940 --> 00:12:39,640 In a command line interface, you need to be more deliberate. 254 00:12:39,640 --> 00:12:44,950 CD space folder, with or without the slash is fine, and then hit Enter. 255 00:12:44,950 --> 00:12:47,560 And now you'll see that your prompt changed. 256 00:12:47,560 --> 00:12:48,880 There's still a dollar sign. 257 00:12:48,880 --> 00:12:51,430 But by convention, and this is CS50 detail, 258 00:12:51,430 --> 00:12:53,560 though other people do this too in the world, 259 00:12:53,560 --> 00:12:57,490 we have prefixed your prompt with a just quick reminder 260 00:12:57,490 --> 00:13:01,060 of what folder you're in so that you don't forget whether you're 261 00:13:01,060 --> 00:13:05,080 in your main folder where you just began, or some other folder therein. 262 00:13:05,080 --> 00:13:08,410 I'm going to go ahead now and type LS to list the contents of this folder. 263 00:13:08,410 --> 00:13:12,070 And of course, there's nothing there because I haven't created any files. 264 00:13:12,070 --> 00:13:17,240 But if I do this, I could do code of farewell.py again to bring it back. 265 00:13:17,240 --> 00:13:19,660 But this time in this folder, hitting Enter, 266 00:13:19,660 --> 00:13:22,840 you'll see a new tab opens here where I can write some more code. 267 00:13:22,840 --> 00:13:26,380 But you'll also see hierarchically here, the farewell.py 268 00:13:26,380 --> 00:13:29,210 is now inside of this folder. 269 00:13:29,210 --> 00:13:32,330 Now suppose this is a mistake and I didn't mean to do that. 270 00:13:32,330 --> 00:13:33,190 What can I do? 271 00:13:33,190 --> 00:13:36,220 Well, let me close the tab here, even without writing any code. 272 00:13:36,220 --> 00:13:39,280 And down in my terminal window, let me do this. 273 00:13:39,280 --> 00:13:43,480 I'm going to type LS to confirm that, yep, farewell.py exists there. 274 00:13:43,480 --> 00:13:47,500 But suppose I want to move it into my main folder. 275 00:13:47,500 --> 00:13:51,460 Well, like on Mac OS or Windows, I could click on the file here, farewell.py, 276 00:13:51,460 --> 00:13:54,320 and just kind of drag it up or down to put it where I want. 277 00:13:54,320 --> 00:13:56,500 But let's move it, not rename it this time, 278 00:13:56,500 --> 00:13:59,470 but move it using that same MV command instead. 279 00:13:59,470 --> 00:14:04,090 I want to move farewell.py to the parent folder. 280 00:14:04,090 --> 00:14:07,880 In the world of files and folders, you can think of things like a family tree. 281 00:14:07,880 --> 00:14:11,720 And if you want to go up hierarchically, you want to go into the parent folder, 282 00:14:11,720 --> 00:14:16,120 so to speak, whereas folder is conversely a child of the default 283 00:14:16,120 --> 00:14:18,080 folder in which we began. 284 00:14:18,080 --> 00:14:20,380 So I want to move farewell higher up. 285 00:14:20,380 --> 00:14:21,730 How do I express that? 286 00:14:21,730 --> 00:14:24,280 Well, another piece of syntax in a command line interface 287 00:14:24,280 --> 00:14:26,560 is typically this, dot, dot. 288 00:14:26,560 --> 00:14:31,630 Dot, dot is a symbolic representation of whatever the parent directory 289 00:14:31,630 --> 00:14:33,520 is, no matter what its name is. 290 00:14:33,520 --> 00:14:35,800 In this case, it's my own default folder. 291 00:14:35,800 --> 00:14:37,870 Doesn't even matter what its name technically is. 292 00:14:37,870 --> 00:14:39,220 It's not pictured on the screen. 293 00:14:39,220 --> 00:14:40,720 I'm going to go ahead and hit Enter. 294 00:14:40,720 --> 00:14:44,560 And watch what happens at top left in the graphical version of the same. 295 00:14:44,560 --> 00:14:48,100 We should see that farewell.py now pops out of the folder 296 00:14:48,100 --> 00:14:52,270 and the indentation changed to imply that it's not inside of the folder now. 297 00:14:52,270 --> 00:14:54,730 It's alongside hello.py. 298 00:14:54,730 --> 00:14:58,060 Indeed, if I close the folder here, I don't see a difference 299 00:14:58,060 --> 00:15:00,220 because there's nothing in there as well. 300 00:15:00,220 --> 00:15:02,890 Let me type LS to confirm in my terminal window. 301 00:15:02,890 --> 00:15:04,310 There's nothing in folder. 302 00:15:04,310 --> 00:15:06,070 Let me now go back to my parent directory. 303 00:15:06,070 --> 00:15:07,390 And I can do this in different ways. 304 00:15:07,390 --> 00:15:09,098 And like with programming itself, there's 305 00:15:09,098 --> 00:15:12,950 going to be many ways sometimes that you can navigate a command line interface. 306 00:15:12,950 --> 00:15:13,750 Here's one. 307 00:15:13,750 --> 00:15:17,650 I can do CD for change directory, and then space dot, 308 00:15:17,650 --> 00:15:20,140 dot to go back to the parent directory. 309 00:15:20,140 --> 00:15:22,150 But another technique, especially if you're 310 00:15:22,150 --> 00:15:24,430 a little less comfortable with this whole new world, 311 00:15:24,430 --> 00:15:26,263 is whenever in doubt, if you want to go back 312 00:15:26,263 --> 00:15:29,770 to your default directory in which you began when you logged in, 313 00:15:29,770 --> 00:15:33,250 just type CD with nothing after it and hit Enter. 314 00:15:33,250 --> 00:15:37,120 And you'll be whisked away back to the starting point. 315 00:15:37,120 --> 00:15:41,800 Indeed, if I type LS now, I'll see farewell.py, my folder if empty, 316 00:15:41,800 --> 00:15:44,145 and hello.py as well. 317 00:15:44,145 --> 00:15:47,270 Now, I don't really need this folder because there's nothing in it anymore. 318 00:15:47,270 --> 00:15:48,687 So let's go ahead and delete that. 319 00:15:48,687 --> 00:15:52,205 I could click on it with control click or right click in the File Explorer. 320 00:15:52,205 --> 00:15:54,580 And I could delete it manually like in Mac OS or Windows. 321 00:15:54,580 --> 00:15:59,530 Or I can use my newfound commands, rmdir for remove directory, space folder, 322 00:15:59,530 --> 00:16:01,690 with or without the slash, and hit Enter. 323 00:16:01,690 --> 00:16:03,940 And because it's empty, I'm not even prompted. 324 00:16:03,940 --> 00:16:06,430 It just goes away quite cleanly. 325 00:16:06,430 --> 00:16:09,250 And a final technique that you'll find quite helpful 326 00:16:09,250 --> 00:16:11,500 in the context of a command line interface 327 00:16:11,500 --> 00:16:14,620 is that it tends to store your whole history of commands. 328 00:16:14,620 --> 00:16:16,480 In fact, not just autocomplete. 329 00:16:16,480 --> 00:16:20,170 But if I hit up, and up, and up, and up, you'll 330 00:16:20,170 --> 00:16:24,250 see my history of all previous commands scrolling up on there 331 00:16:24,250 --> 00:16:27,798 on the screen, which is helpful if I just want to execute one of them again. 332 00:16:27,798 --> 00:16:29,340 I don't need to manually type it out. 333 00:16:29,340 --> 00:16:32,670 I can scroll up and down and find the one that I want. 334 00:16:32,670 --> 00:16:35,390 So this then is just the scratching of the surface 335 00:16:35,390 --> 00:16:38,270 of a command line interface in the context of Visual Studio 336 00:16:38,270 --> 00:16:39,260 Code in the cloud. 337 00:16:39,260 --> 00:16:43,610 Most of these commands would be the same whether on your Mac or PC, at least 338 00:16:43,610 --> 00:16:48,080 if you're using a terminal window that's connected to a computer running Linux, 339 00:16:48,080 --> 00:16:51,260 be it a container, or a virtual machine, or an actual server somewhere 340 00:16:51,260 --> 00:16:51,980 in the cloud. 341 00:16:51,980 --> 00:16:57,260 In the weeks to come for this class, will you have access to code.cs.cs50.io 342 00:16:57,260 --> 00:17:02,480 and in turn your own code space so that you have access 24/7 365 via a browser 343 00:17:02,480 --> 00:17:04,550 alone so long as you have internet access 344 00:17:04,550 --> 00:17:07,860 without needing to install anything on your own Mac or PC. 345 00:17:07,860 --> 00:17:10,610 Toward the end of the semester, if you're feeling more comfortable 346 00:17:10,610 --> 00:17:12,560 and would like to use this same software, 347 00:17:12,560 --> 00:17:16,280 VS Code, if not Linux as well, you'll be able to also install 348 00:17:16,280 --> 00:17:19,220 those for free on your own Mac or PC and continue programming 349 00:17:19,220 --> 00:17:22,400 onward even after the courses own end. 350 00:17:22,400 --> 00:17:24,745 This then was Visual Studio Code for CS50, 351 00:17:24,745 --> 00:17:27,050 and with it, a command line interface. 352 00:17:27,050 --> 00:17:30,339 And this is CS50 itself. 353 00:17:30,339 --> 00:17:32,170