0:00:00.650,0:00:07.799 all right everyone thanks for coming in. 0:00:02.428,0:00:07.799 This is the missing semester of your CS Education; 0:00:07.799,0:00:11.519 at least that's what we chose to call 0:00:09.960,0:00:13.679 the class. if you're not here for this 0:00:11.519,0:00:15.900 class then you're in the wrong room. We 0:00:13.679,0:00:19.590 will be here for about an hour just to 0:00:15.900,0:00:21.180 set your expectations and I want to talk 0:00:19.590,0:00:23.789 to you a little bit first about why 0:00:21.180,0:00:25.980 we're doing this class. So this class 0:00:23.789,0:00:29.670 stems out of an observation that Anish 0:00:25.980,0:00:33.030 and Jose and I have made while TA-ing various 0:00:29.670,0:00:34.710 classes at MIT which is that basically 0:00:31.320,0:00:34.710 all of us computer scientists, we know 0:00:34.710,0:00:38.370 that computers are great at doing these 0:00:36.420,0:00:41.250 repetitive tasks and automating things 0:00:38.370,0:00:43.020 but we often fail to realize that there 0:00:41.250,0:00:45.930 are lots of tools that can make our own 0:00:43.020,0:00:47.520 development processes better. We can be a 0:00:45.930,0:00:49.620 lot more efficient about how we use our 0:00:47.520,0:00:51.989 computers because we can use the 0:00:49.620,0:00:54.360 computer as a tool for ourselves not 0:00:51.989,0:00:57.809 just for building websites or software 0:00:54.360,0:00:59.670 those sorts of things and this class is 0:00:57.809,0:01:03.000 an attempt to address - this is an attempt 0:00:59.670,0:01:05.220 to show you some of the tools that you 0:01:03.000,0:01:07.640 can use to great effect in your day to 0:01:05.220,0:01:11.670 day in your research and in your studies 0:01:07.640,0:01:15.150 and it's going to be a class where we 0:01:10.381,0:01:15.150 want you to teach you both how to make 0:01:15.150,0:01:19.200 the most of the tools that you already 0:01:16.439,0:01:20.909 know but also hopefully teach you about 0:01:19.200,0:01:23.520 some tools so you don't know from before 0:01:20.909,0:01:26.250 and how to combine those tools to 0:01:23.520,0:01:28.140 produce more powerful things than you 0:01:26.250,0:01:31.049 think you might be able to do with what 0:01:28.140,0:01:33.420 you know today the class is going to be 0:01:31.049,0:01:36.630 structured as a series of 11 one-hour 0:01:33.420,0:01:38.880 lectures and each one is going to cover 0:01:36.630,0:01:40.920 a particular topic you can see the 0:01:38.880,0:01:43.439 website which is also listed there for 0:01:40.920,0:01:45.990 the list of lecture topics and what date 0:01:43.439,0:01:48.210 will do each one they will mostly be 0:01:45.990,0:01:49.350 independent and so you can sort of show 0:01:48.210,0:01:51.450 up for the ones that you're interested 0:01:49.350,0:01:53.610 in but we will sort of assume that 0:01:51.450,0:01:55.649 you've been following along so that as 0:01:53.610,0:01:57.030 we get to later lectures I'm not going 0:01:55.649,0:02:02.280 to be teaching you bash all over again 0:01:57.030,0:02:05.310 for example we we are also going to post 0:02:02.280,0:02:08.459 both the lecture notes and recordings of 0:02:05.310,0:02:10.110 the lectures online exactly when we do 0:02:08.459,0:02:12.330 that we haven't established yet but it 0:02:10.110,0:02:14.280 will be after the lectures obviously the 0:02:12.330,0:02:16.620 videos have to be posted after 0:02:14.280,0:02:19.380 the class is gonna be run by me John and 0:02:16.620,0:02:21.120 Anne each sitting over there and Jose 0:02:19.380,0:02:24.090 who is not currently here but we'll be 0:02:21.120,0:02:25.740 holding tomorrow's lecture and keep in 0:02:24.090,0:02:27.990 mind that we're trying to cover a lot of 0:02:25.740,0:02:30.720 ground over the course of just 11 0:02:27.990,0:02:33.240 one-hour lectures and so we will be 0:02:30.720,0:02:35.460 moving relatively rapidly but please do 0:02:33.240,0:02:37.080 stop us if there's anything where you 0:02:35.460,0:02:38.430 feel like you're not following along if 0:02:37.080,0:02:40.290 you feel like there's something you wish 0:02:38.430,0:02:41.730 we would spend more time on just let us 0:02:40.290,0:02:45.240 know please interrupt us with questions 0:02:41.730,0:02:47.220 and also after each lecture we're going 0:02:45.240,0:02:49.650 to hold office hours on the ninth floor 0:02:47.220,0:02:51.570 of building 30 to the Stata Center of 0:02:49.650,0:02:53.220 the computer science building as if you 0:02:51.570,0:02:55.980 show up up in the ninth floor lounge 0:02:53.220,0:02:58.140 there and the gates tower then you can 0:02:55.980,0:03:00.750 come and try some of the exercises that 0:02:58.140,0:03:02.940 we give for each lecture or just ask us 0:03:00.750,0:03:04.440 other questions about things we've 0:03:02.940,0:03:08.000 talked about in lecturer or other things 0:03:04.440,0:03:08.000 about using your computer efficiently 0:03:08.150,0:03:13.740 due to the limited time that we have 0:03:11.640,0:03:16.530 available we're not going to be able to 0:03:13.740,0:03:19.080 cover all tools and full detail and so 0:03:16.530,0:03:21.240 we'll try to do is highlight interesting 0:03:19.080,0:03:23.430 tools and interesting ways to use them 0:03:21.240,0:03:25.110 we won't necessarily dig into the deep 0:03:23.430,0:03:27.540 details about how all of it works or 0:03:25.110,0:03:29.070 more elaborate use cases but if you have 0:03:27.540,0:03:31.050 questions about them please come ask us 0:03:29.070,0:03:33.690 about that too many of these tools are 0:03:31.050,0:03:34.860 tools that we have used for years and we 0:03:33.690,0:03:36.680 might be able to point you to additional 0:03:34.860,0:03:39.060 interesting things you can do with them 0:03:36.680,0:03:42.990 sort of like take advantage of the fact 0:03:39.060,0:03:45.210 that we're here this class is going to I 0:03:42.990,0:03:46.980 don't wanna say ramped up quickly but 0:03:45.210,0:03:49.050 what's going to happen over the course 0:03:46.980,0:03:51.330 of this particular lecture is that we'll 0:03:49.050,0:03:52.530 cover many of the basics that we assume 0:03:51.330,0:03:54.480 that you will know for the rest of the 0:03:52.530,0:03:56.010 semester things like how to use your 0:03:54.480,0:03:57.210 shell and your terminal and I'll explain 0:03:56.010,0:03:59.850 what those are - those who you're not 0:03:57.210,0:04:01.890 familiar with them and then will pretty 0:03:59.850,0:04:03.840 quickly ramp up into more advanced tools 0:04:01.890,0:04:05.250 and how to use them you can already see 0:04:03.840,0:04:07.490 from the lecture notes the kind of 0:04:05.250,0:04:10.110 topics that we're going to be covering 0:04:07.490,0:04:12.120 and so that brings us to today's lecture 0:04:10.110,0:04:14.640 in which we are going to cover the shell 0:04:12.120,0:04:16.950 and the shell is going to be one of the 0:04:14.640,0:04:19.290 primary ways that you interact with your 0:04:16.950,0:04:21.299 computer once you want to do more things 0:04:19.290,0:04:24.540 than what the sort of visual interfaces 0:04:21.299,0:04:26.370 you might be used to allow you to do the 0:04:24.540,0:04:26.550 visual interfaces are sort of limited in 0:04:26.370,0:04:28.560 what 0:04:26.550,0:04:29.669 they allow you to do because you can 0:04:28.560,0:04:32.009 only do the things that there are 0:04:29.669,0:04:34.919 buttons for sliders for input fields for 0:04:32.009,0:04:37.470 often these textual tools are built to 0:04:34.919,0:04:39.900 be both composable with one another but 0:04:37.470,0:04:41.430 also to have tons of different ways to 0:04:39.900,0:04:42.960 combine them or ways to program and 0:04:41.430,0:04:44.940 automate them and that is why in this 0:04:42.960,0:04:48.060 class we will be focusing on these 0:04:44.940,0:04:49.860 command line or text-based tools and the 0:04:48.060,0:04:51.870 shell is the place that you would do 0:04:49.860,0:04:53.849 most of this work so for those of you 0:04:51.870,0:04:56.729 are not familiar with the shell most 0:04:53.849,0:04:59.219 platform provides some kind of shell on 0:04:56.729,0:05:00.780 Windows this is often PowerShell but 0:04:59.219,0:05:04.139 there are also other shells available on 0:05:00.780,0:05:06.389 Windows on Linux you will find tons of 0:05:04.139,0:05:08.219 terminals these are windows that allow 0:05:06.389,0:05:10.500 you to display shells and you'll also 0:05:08.219,0:05:13.229 find many different types of shells the 0:05:10.500,0:05:15.810 most common of which is bash or the born 0:05:13.229,0:05:17.460 again shell because it's such a common 0:05:15.810,0:05:18.990 shell it is the one we're primarily 0:05:17.460,0:05:21.300 going to be covering in these lectures 0:05:18.990,0:05:23.580 if you're on Mac OS you will probably 0:05:21.300,0:05:26.159 also have bash maybe an older version of 0:05:23.580,0:05:27.479 it if you open the terminal app and so 0:05:26.159,0:05:29.190 if you want to follow along on any of 0:05:27.479,0:05:30.210 these platforms feel free but keep in 0:05:29.190,0:05:32.520 mind that most of this is going to be 0:05:30.210,0:05:34.229 sort of Linux centric in terms of how we 0:05:32.520,0:05:39.000 teach it even though most of these tools 0:05:34.229,0:05:40.409 work on all the platforms if you want to 0:05:39.000,0:05:42.539 install a terminal and a shell and you 0:05:40.409,0:05:45.330 don't know how to do it well we're happy 0:05:42.539,0:05:47.400 to show you at office hours or it's 0:05:45.330,0:05:51.599 usually very easy to just Google like 0:05:47.400,0:05:57.060 your platform plus like terminal and you 0:05:51.599,0:05:59.039 will get one now when you open a 0:05:57.060,0:06:01.169 terminal you get something that looks a 0:05:59.039,0:06:04.229 little bit like this so it will usually 0:06:01.169,0:06:06.000 have just a single line at the top and 0:06:04.229,0:06:07.710 this is what's known as the shell prompt 0:06:06.000,0:06:10.020 you can see that my shell prompt looks 0:06:07.710,0:06:12.090 like this it has my user name the name 0:06:10.020,0:06:14.219 of the machine that I'm on the current 0:06:12.090,0:06:16.770 path I'm on and we will talk about paths 0:06:14.219,0:06:18.719 a little bit later and then it's really 0:06:16.770,0:06:20.969 just sort of blinking they're asking me 0:06:18.719,0:06:22.440 for input and this is the shell prompt 0:06:20.969,0:06:25.860 where you tell the shell what you want 0:06:22.440,0:06:27.479 it to do and you can customize this 0:06:25.860,0:06:28.620 prompt a lot and when you open it on 0:06:27.479,0:06:31.139 your machine it might not look exactly 0:06:28.620,0:06:33.840 like this it might look something like 0:06:31.139,0:06:35.399 this if you've configured it a little or 0:06:33.840,0:06:38.279 it might look all sorts of different 0:06:35.399,0:06:39.779 ways we won't go too much into 0:06:38.279,0:06:40.350 customizing your shell in this 0:06:39.779,0:06:41.910 particularly 0:06:40.350,0:06:43.710 we'll do that later here we're just 0:06:41.910,0:06:47.790 going to talk about how do you use this 0:06:43.710,0:06:49.860 shell to do useful things and this is 0:06:47.790,0:06:51.750 our the main textual interface you have 0:06:49.860,0:06:53.430 to your computer's through this shell on 0:06:51.750,0:06:55.950 the shell prompt you get to write 0:06:53.430,0:06:58.920 commands and commands can be relatively 0:06:55.950,0:07:00.570 straightforward things usually it'll be 0:06:58.920,0:07:02.550 something like executing programs with 0:07:00.570,0:07:04.470 arguments what does that look like well 0:07:02.550,0:07:06.210 one program we can execute is the date 0:07:04.470,0:07:07.380 program we just type date and press 0:07:06.210,0:07:10.290 enter and then it will show you 0:07:07.380,0:07:12.330 unsurprisingly the date and time you can 0:07:10.290,0:07:14.850 also execute a program with arguments 0:07:12.330,0:07:17.790 this is one way to modify the behavior 0:07:14.850,0:07:20.760 of the program so for example there is a 0:07:17.790,0:07:22.410 program called echo and echo just prints 0:07:20.760,0:07:25.050 out the arguments that you give it and 0:07:22.410,0:07:27.330 arguments are just white space separated 0:07:25.050,0:07:29.820 things that follow the program name so 0:07:27.330,0:07:30.720 we can say hello and then it will print 0:07:29.820,0:07:32.940 hello back 0:07:30.720,0:07:35.610 perhaps not terribly surprising but this 0:07:32.940,0:07:37.050 is the very basics of arguments one 0:07:35.610,0:07:38.550 thing that you'll notice is that I said 0:07:37.050,0:07:40.380 that arguments are separated by 0:07:38.550,0:07:42.060 whitespace and you might wonder well 0:07:40.380,0:07:44.310 what if I want an argument as multiple 0:07:42.060,0:07:47.220 words you can also quote things so you 0:07:44.310,0:07:50.310 can do things like echo hello space 0:07:47.220,0:07:52.710 world and now the echo program receives 0:07:50.310,0:07:55.380 one argument that contains the string 0:07:52.710,0:07:57.540 hello world with a space well you can 0:07:55.380,0:07:58.770 also use single quotes for this and the 0:07:57.540,0:08:00.480 difference between single quotes and 0:07:58.770,0:08:03.420 double quotes will get back to and when 0:08:00.480,0:08:06.120 we talk about bash scripting you can 0:08:03.420,0:08:09.000 also just escape single characters so 0:08:06.120,0:08:12.150 for example hello world this will also 0:08:09.000,0:08:15.720 work just fine all of these rules about 0:08:12.150,0:08:17.340 how you escape and how you parse and 0:08:15.720,0:08:19.590 quote various arguments and variables 0:08:17.340,0:08:21.330 we'll cover a little bit later hopefully 0:08:19.590,0:08:23.520 you won't run into too many we oughta 0:08:21.330,0:08:26.070 tease about this just keep in mind at 0:08:23.520,0:08:27.930 least that spaces separate arguments so 0:08:26.070,0:08:29.610 if you want to do something like make a 0:08:27.930,0:08:31.920 directory called my photos 0:08:29.610,0:08:33.780 you can't just type like make directory 0:08:31.920,0:08:35.880 my photos it will create two directories 0:08:33.780,0:08:40.010 one called my and one called photos and 0:08:35.880,0:08:43.229 that is probably not what you want now 0:08:40.010,0:08:45.600 one thing you might ask is how does the 0:08:43.229,0:08:48.839 shell know what these programs are when 0:08:45.600,0:08:50.700 I type date or when I type echo how does 0:08:48.839,0:08:53.190 it know what these programs are supposed 0:08:50.700,0:08:54.000 to do and the answer to this is your 0:08:53.190,0:08:55.439 program your 0:08:54.000,0:08:57.000 computer has a bunch of built-in 0:08:55.439,0:08:59.759 programs that comes with the machine 0:08:57.000,0:09:02.579 just like you your machine my chip with 0:08:59.759,0:09:05.339 like the terminal app or it might chip 0:09:02.579,0:09:07.800 with like Windows Explorer or at my chip 0:09:05.339,0:09:09.569 with some kind of browser it also ships 0:09:07.800,0:09:11.639 with a bunch of terminal centric 0:09:09.569,0:09:14.819 applications and these are stored on 0:09:11.639,0:09:18.209 your file system and your shell has a 0:09:14.819,0:09:19.949 way to determine where a program is 0:09:18.209,0:09:22.459 located basically has a way to search 0:09:19.949,0:09:24.620 for programs it does this through 0:09:22.459,0:09:27.389 something called an invariant 0:09:24.620,0:09:29.970 environment variable an environment 0:09:27.389,0:09:31.560 variable is a variable like you might be 0:09:29.970,0:09:33.899 used to for programming languages it 0:09:31.560,0:09:35.160 turns out that the shell and the 0:09:33.899,0:09:37.350 bourne-again shell in particular is 0:09:35.160,0:09:39.420 really a programming language this 0:09:37.350,0:09:41.550 prompt that you're given here is not 0:09:39.420,0:09:43.470 just able to run a program with 0:09:41.550,0:09:46.470 arguments. You can also do things like 0:09:43.470,0:09:47.910 while loops, for loops, conditionals... 0:09:46.470,0:09:49.860 All of these - you can define 0:09:47.910,0:09:51.000 functions, you can have variables, and all 0:09:49.860,0:09:52.860 of these things you can do in the shell. 0:09:51.000,0:09:56.399 We'll cover a lot of that in the next 0:09:52.860,0:09:57.990 lecture, on shell scripting. For now, 0:09:56.399,0:09:59.790 though, let's just look at this 0:09:57.990,0:10:01.199 particular environment variable. 0:09:59.790,0:10:02.699 Environment variables are things that 0:10:01.199,0:10:04.829 are set whenever you start your shell 0:10:02.699,0:10:06.600 they're not things you have to set every 0:10:04.829,0:10:08.160 time you run your shell there are a 0:10:06.600,0:10:09.750 bunch of these that are set things like 0:10:08.160,0:10:11.850 where is your home directory what is 0:10:09.750,0:10:13.079 your username and there's also one 0:10:11.850,0:10:16.170 that's critical for this particular 0:10:13.079,0:10:18.930 purpose which is the path variable so if 0:10:16.170,0:10:22.589 I echo out dollar path this is going to 0:10:18.930,0:10:25.100 show me all of the paths on my machine 0:10:22.589,0:10:27.930 that the shell will search for programs 0:10:25.100,0:10:30.870 you'll notice that this is a list that 0:10:27.930,0:10:33.000 is colon separated it might be kind of 0:10:30.870,0:10:36.000 long and hard to read but the essentials 0:10:33.000,0:10:38.279 is that - whenever you type the name of 0:10:36.000,0:10:41.610 a program is gonna search through this 0:10:38.279,0:10:43.769 list of paths on your machine and it's 0:10:41.610,0:10:46.920 gonna look in each directory for a 0:10:43.769,0:10:49.110 program or a file whose name matches the 0:10:46.920,0:10:51.029 command you try to run so in my case 0:10:49.110,0:10:52.800 when I try to run date or echo it's 0:10:51.029,0:10:54.509 gonna walk through these one at a time 0:10:52.800,0:10:56.370 until it finds one that contains the 0:10:54.509,0:10:58.410 program called date or echo and then 0:10:56.370,0:11:00.000 it's gonna run it if we want to know 0:10:58.410,0:11:01.649 which one it actually runs there's a 0:11:00.000,0:11:04.620 command called which which lets us do 0:11:01.649,0:11:07.500 that so I can type which echo and will 0:11:04.620,0:11:10.830 tell me that if I were to run a program 0:11:07.500,0:11:12.720 called echo I would run this one it's 0:11:10.830,0:11:16.350 worth pausing here to talk about what 0:11:12.720,0:11:18.620 paths are so paths are a way to name the 0:11:16.350,0:11:21.630 location of a file on your computer on 0:11:18.620,0:11:24.780 Linux and Oh Mac OS these paths are 0:11:21.630,0:11:28.170 separated by slashes forward slashes so 0:11:24.780,0:11:30.930 you'll see here that this is in the in 0:11:28.170,0:11:32.760 the root directory so the slash at the 0:11:30.930,0:11:34.850 very beginning indicates that this is 0:11:32.760,0:11:37.710 starting from the top of the file system 0:11:34.850,0:11:40.980 then look inside the directory called 0:11:37.710,0:11:43.580 USR then look inside the directory bin 0:11:40.980,0:11:46.440 and then look for the file called echo 0:11:43.580,0:11:48.620 on windows paths like this are usually 0:11:46.440,0:11:51.900 separated by back slashes instead and 0:11:48.620,0:11:53.640 we're on Linux and Mac OS everything 0:11:51.900,0:11:56.370 lives under the root name space so all 0:11:53.640,0:12:00.270 paths start with a slash or all absolute 0:11:56.370,0:12:02.070 paths on Windows there is one root for 0:12:00.270,0:12:05.130 every partition so you might have seen 0:12:02.070,0:12:08.220 things like C colon backslash or D colon 0:12:05.130,0:12:11.340 backslash so Windows has separate sort 0:12:08.220,0:12:13.050 of file system path hierarchies for each 0:12:11.340,0:12:14.850 each Drive that you have 0:12:13.050,0:12:18.540 whereas on Linux and Mac OS these are 0:12:14.850,0:12:20.010 all mounted under one namespace you'll 0:12:18.540,0:12:21.690 notice that I said the word absolute 0:12:20.010,0:12:27.360 path and you might not know what that 0:12:21.690,0:12:29.460 means so absolute paths are paths that 0:12:27.360,0:12:31.890 fully determine the location of a file 0:12:29.460,0:12:33.720 so in this case this is saying this is 0:12:31.890,0:12:36.540 talking only about a specific echo file 0:12:33.720,0:12:39.030 and it's giving you the the full path to 0:12:36.540,0:12:42.839 that file but there are also things 0:12:39.030,0:12:45.240 known as relative paths so a relative 0:12:42.839,0:12:49.320 path is relative to where you currently 0:12:45.240,0:12:52.490 are and so the way we find out where we 0:12:49.320,0:12:56.190 currently are is you can type PWD for 0:12:52.490,0:13:00.060 present working directory present print 0:12:56.190,0:13:02.700 working directory so if I type PWD it 0:13:00.060,0:13:05.790 will print out the current path that I'm 0:13:02.700,0:13:08.220 in right so currently I'm in the home 0:13:05.790,0:13:11.030 directory under the root and then John 0:13:08.220,0:13:14.730 under that and then dev under that etc 0:13:11.030,0:13:16.770 from here I can then choose to change my 0:13:14.730,0:13:18.540 current working directory and all 0:13:16.770,0:13:20.190 relative paths are relative to the 0:13:18.540,0:13:21.329 current working directory which is 0:13:20.190,0:13:24.629 basically where you 0:13:21.329,0:13:28.709 they are in this case for example I can 0:13:24.629,0:13:30.449 do CD / home CDs change directory this 0:13:28.709,0:13:32.610 is the way that I change what my current 0:13:30.449,0:13:34.829 working directory is in this case I 0:13:32.610,0:13:37.889 change to home and I am now you'll see 0:13:34.829,0:13:40.619 my my shell prompt change to say that I 0:13:37.889,0:13:42.660 am now in home it just gives me the name 0:13:40.619,0:13:44.220 of the last segment of the path but you 0:13:42.660,0:13:45.509 can also configure your terminal to give 0:13:44.220,0:13:50.309 you the full path whenever you're 0:13:45.509,0:13:53.100 anywhere and now if I type PWD again it 0:13:50.309,0:13:54.869 will tell me I'm in slash home there are 0:13:53.100,0:13:59.100 also a couple of special directories 0:13:54.869,0:14:03.149 that exist there is dot and dot dot dot 0:13:59.100,0:14:05.129 means the current directory dot dot 0:14:03.149,0:14:06.749 means the parent directory so this is a 0:14:05.129,0:14:09.540 way that you can easily navigate around 0:14:06.749,0:14:13.079 the system for example here if I type CD 0:14:09.540,0:14:15.179 dot dot it will tell me that I am now in 0:14:13.079,0:14:17.639 slash so I'm now in the root of the file 0:14:15.179,0:14:22.139 system I was in slash home now I'm in 0:14:17.639,0:14:24.869 slash and indeed if I type PWD well it 0:14:22.139,0:14:26.790 will do that right thing and I can also 0:14:24.869,0:14:28.980 then use relative paths to go down into 0:14:26.790,0:14:31.769 the file system right so I can do CD dot 0:14:28.980,0:14:34.079 slash home and this is gonna CD into the 0:14:31.769,0:14:36.899 home directory under the current 0:14:34.079,0:14:39.839 directory right so this will bring me 0:14:36.899,0:14:42.119 back to slash home if I now tried CD dot 0:14:39.839,0:14:44.100 slash home again it will say there's no 0:14:42.119,0:14:45.569 such directory because there is no home 0:14:44.100,0:14:49.429 directory under the current directory 0:14:45.569,0:14:53.699 I'm on which I changed by doing CD right 0:14:49.429,0:14:57.509 and I can sort of see de all the way 0:14:53.699,0:15:01.110 back to the place that I was using 0:14:57.509,0:15:07.040 relative paths and I can also do things 0:15:01.110,0:15:09.059 like dot dot dot dot dot to get back to 0:15:07.040,0:15:10.649 somewhere deep in my file system this 0:15:09.059,0:15:13.019 happens to be all the way back to the 0:15:10.649,0:15:15.629 root so here there's a bin directory and 0:15:13.019,0:15:17.850 another bin there's an echo file and so 0:15:15.629,0:15:20.309 then I could do world and that runs the 0:15:17.850,0:15:22.079 echo program under bin alright so this 0:15:20.309,0:15:24.439 is a way that you can construct paths to 0:15:22.079,0:15:26.579 arbitrarily traverse your filesystem 0:15:24.439,0:15:28.379 sometimes you want to absolute paths and 0:15:26.579,0:15:29.789 sometimes you want relative ones usually 0:15:28.379,0:15:33.179 you want to use whichever one is shorter 0:15:29.789,0:15:34.390 but if you want to for example run a 0:15:30.629,0:15:34.390 program or write 0:15:34.390,0:15:38.980 a program that runs the program like 0:15:36.940,0:15:41.830 echo or date and you want it to be able 0:15:38.980,0:15:43.660 to run be run from anywhere you either 0:15:41.830,0:15:45.640 want to just give the name of the 0:15:43.660,0:15:47.770 program like date or echo and let the the 0:15:45.640,0:15:49.720 shell use the path to figure out where 0:15:47.770,0:15:51.670 it is or you want to give its absolute 0:15:49.720,0:15:53.500 path because if you gave a relative path 0:15:51.670,0:15:55.840 then if I ran it in my home directory 0:15:53.500,0:16:01.720 and you ran it in some other directory 0:15:55.840,0:16:04.600 it might work for me but not for you in 0:16:01.720,0:16:06.340 general when we run a program it is 0:16:04.600,0:16:08.320 going to be operating on the current 0:16:06.340,0:16:09.910 working directory at least by default 0:16:08.320,0:16:11.980 unless we give it any other arguments 0:16:09.910,0:16:13.750 and this is really handy because it 0:16:11.980,0:16:15.730 means that often we don't have to give 0:16:13.750,0:16:17.680 full paths for things we can just use 0:16:15.730,0:16:20.050 the name of files and in the directory 0:16:17.680,0:16:22.570 that we're currently in one thing that's 0:16:20.050,0:16:24.280 really useful is to figure out what is 0:16:22.570,0:16:26.410 in the current directory we're in so we 0:16:24.280,0:16:28.060 already saw PWD which prints where you 0:16:26.410,0:16:31.090 currently are there's a command called 0:16:28.060,0:16:33.310 LS which will show you it will list the 0:16:31.090,0:16:35.980 files in the current directory so if i 0:16:33.310,0:16:38.050 type LS here this is all the files in 0:16:35.980,0:16:39.850 the current directory right and this is 0:16:38.050,0:16:43.420 a handy way to just quickly navigate 0:16:39.850,0:16:46.930 through the filesystem you'll see that 0:16:43.420,0:16:48.490 if I sort of CD dot and then do LS it'll 0:16:46.930,0:16:53.370 show me the files in that directory 0:16:48.490,0:16:56.260 instead but with LS I can also give it 0:16:53.370,0:16:58.360 LS dot dot like I can give it a path and 0:16:56.260,0:16:59.920 then will LS that file instead of the 0:16:58.360,0:17:04.270 one that I'm currently in or LS that 0:16:59.920,0:17:05.829 directory and you can see this if I go 0:17:04.270,0:17:09.220 all the way to the root as well right 0:17:05.829,0:17:11.560 root has different files one handy trick 0:17:09.220,0:17:13.570 you might not know about here is there 0:17:11.560,0:17:16.570 are two other special things you can do 0:17:13.570,0:17:18.339 one is the tilde character this 0:17:16.570,0:17:21.130 character brings you to your home 0:17:18.339,0:17:23.140 directory so tilde always expands to the 0:17:21.130,0:17:25.780 home directory and you can do relative 0:17:23.140,0:17:30.040 paths to it so I can do tilde slash dev 0:17:25.780,0:17:32.980 slash P DOS classes missing semester and 0:17:30.040,0:17:36.670 now I'm there because tilde expanded to 0:17:32.980,0:17:39.460 slash home slash John there is also for 0:17:36.670,0:17:42.250 CD in particular a really handy argument 0:17:39.460,0:17:44.530 you can give which is - if you do CD - 0:17:42.250,0:17:47.380 it will CD to the directory you were 0:17:44.530,0:17:48.180 previously in so if I do CD - I go back 0:17:47.380,0:17:52.230 to root 0:17:48.180,0:17:53.880 if I do CD - again I go back to missing 0:17:52.230,0:17:55.080 semester so this is a handy way if you 0:17:53.880,0:18:01.290 want to toggle between two different 0:17:55.080,0:18:03.570 directories in the case of LS or in the 0:18:01.290,0:18:06.180 case of CD there might be arguments do 0:18:03.570,0:18:07.560 you don't know about right currently we 0:18:06.180,0:18:09.510 haven't really been doing anything 0:18:07.560,0:18:11.520 except giving paths but how do you even 0:18:09.510,0:18:14.250 discover that you can give a path to LS 0:18:11.520,0:18:16.530 in the first place well most programs 0:18:14.250,0:18:18.840 take what are known as arguments like 0:18:16.530,0:18:21.570 flags and options these are things that 0:18:18.840,0:18:24.810 usually start with a - one of the Hemi 0:18:21.570,0:18:26.880 is one of these is - help most programs 0:18:24.810,0:18:30.000 implement this and if you run for 0:18:26.880,0:18:34.020 example LS - help it all helpfully print 0:18:30.000,0:18:36.000 out a bunch of information about that 0:18:34.020,0:18:38.400 command and you'll see here that it says 0:18:36.000,0:18:40.260 the usage is LS and you can give some 0:18:38.400,0:18:42.030 number of options and you can give some 0:18:40.260,0:18:46.350 number of files the way to read that 0:18:42.030,0:18:48.600 usage line is triple dot means one like 0:18:46.350,0:18:50.850 zero or one or more and the square 0:18:48.600,0:18:52.890 bracket means optional so in this case 0:18:50.850,0:18:54.300 there's an optional number of options 0:18:52.890,0:18:56.790 and there's an optional number of files 0:18:54.300,0:18:58.740 and you'll see that it says what the 0:18:56.790,0:19:00.720 program does and also specifies a number 0:18:58.740,0:19:03.000 of different types of flags and options 0:19:00.720,0:19:04.950 you can give usually we call things that 0:19:03.000,0:19:07.830 are a single dash in a single letter a 0:19:04.950,0:19:09.900 flag and anything that or anything that 0:19:07.830,0:19:11.730 doesn't take a value a flag and anything 0:19:09.900,0:19:16.640 that does take a value an option so for 0:19:11.730,0:19:22.260 example - a and - all are both flags and 0:19:16.640,0:19:24.180 - C or - color R is an option one thing 0:19:22.260,0:19:30.330 you'll see under here if you scroll down 0:19:24.180,0:19:37.140 far enough is the - L flag and that's 0:19:30.330,0:19:39.480 unhelpful the - L flag the - L flag uses 0:19:37.140,0:19:40.860 a long listing format now that's 0:19:39.480,0:19:43.350 particularly helpful in and of itself 0:19:40.860,0:19:46.890 but let's see what it actually does so 0:19:43.350,0:19:48.450 if I do LS dash L it still prints the 0:19:46.890,0:19:49.890 files in the current directory but it 0:19:48.450,0:19:52.170 gives me a lot more information about 0:19:49.890,0:19:54.600 those files and this is something you'll 0:19:52.170,0:19:56.280 find yourself using quite a lot because 0:19:54.600,0:20:00.810 the additional information it gives you 0:19:56.280,0:20:02.010 is often quite handy let's look at what 0:20:00.810,0:20:09.030 some of that information 0:20:02.010,0:20:10.110 ah so first of all the D at the 0:20:09.030,0:20:11.760 beginning of some of these entries 0:20:10.110,0:20:14.820 indicate that something is a directory 0:20:11.760,0:20:16.020 so the underscore data entry here for 0:20:14.820,0:20:18.690 example is a directory 0:20:16.020,0:20:22.650 whereas for for hTML is not a directory 0:20:18.690,0:20:25.410 it's a file the following letters after 0:20:22.650,0:20:28.650 that indicate the permissions that are 0:20:25.410,0:20:30.810 set for that file so this like we saw 0:20:28.650,0:20:32.640 earlier I might not be able to open a 0:20:30.810,0:20:34.170 given file or I might not be able to CD 0:20:32.640,0:20:35.760 into a given directory and this is all 0:20:34.170,0:20:37.980 dictated by the permissions on that 0:20:35.760,0:20:41.430 particular file or directory the way to 0:20:37.980,0:20:43.500 read these is that the the first group 0:20:41.430,0:20:45.810 of three are the permissions are set for 0:20:43.500,0:20:49.560 the owner of the file all of these files 0:20:45.810,0:20:52.020 you'll see are owned by me the second 0:20:49.560,0:20:53.880 group of three characters is for the 0:20:52.020,0:20:56.100 permissions for the group that owns this 0:20:53.880,0:20:58.650 file in this case all of these files are 0:20:56.100,0:21:01.770 also known by the john group and a final 0:20:58.650,0:21:03.900 group of three is a list of the 0:21:01.770,0:21:06.290 permissions for everyone else so anyone 0:21:03.900,0:21:08.550 who's not a user owner or a group owner 0:21:06.290,0:21:10.980 this directory is perhaps kind of boring 0:21:08.550,0:21:14.190 because all of the things are owned by 0:21:10.980,0:21:17.490 me but if we do something like CD to 0:21:14.190,0:21:20.280 slash and do LS dash L you'll see that 0:21:17.490,0:21:22.800 here all of them are owned by root we'll 0:21:20.280,0:21:24.090 get back to what the root user is but 0:21:22.800,0:21:26.400 here you see some of the permissions are 0:21:24.090,0:21:31.410 a little bit more interesting the groups 0:21:26.400,0:21:34.290 of three are read write and execute what 0:21:31.410,0:21:36.450 these mean differs for files and for 0:21:34.290,0:21:37.980 directories for files it's pretty 0:21:36.450,0:21:40.170 straightforward if you have read 0:21:37.980,0:21:41.820 permissions on a file then you can read 0:21:40.170,0:21:43.950 its contents if you have write 0:21:41.820,0:21:46.200 permissions on a file then you can save 0:21:43.950,0:21:48.270 the file you can add more to it or you 0:21:46.200,0:21:50.670 can replace it entirely and if you have 0:21:48.270,0:21:52.620 execute to the X bit on a file then 0:21:50.670,0:21:57.390 you're allowed to execute that file so 0:21:52.620,0:22:00.030 if we do LS al in slash bin that's a 0:21:57.390,0:22:02.640 novel and user bin you'll see that all 0:22:00.030,0:22:04.590 of them have the execute bit set even 0:22:02.640,0:22:06.480 for people who are not the owner of the 0:22:04.590,0:22:08.280 file and this is because the echo 0:22:06.480,0:22:09.420 program for example we want everyone on 0:22:08.280,0:22:11.700 the computer to be able to execute 0:22:09.420,0:22:13.920 there's no reason to say only certain 0:22:11.700,0:22:15.570 users can run echo that doesn't really 0:22:13.920,0:22:18.420 make any make any sense 0:22:15.570,0:22:20.960 for directories though these permissions 0:22:18.420,0:22:23.550 are a little bit different so read 0:22:20.960,0:22:26.460 translates - are you allowed to see 0:22:23.550,0:22:28.770 which files are inside this directory so 0:22:26.460,0:22:30.530 think of read as lists for a directory 0:22:28.770,0:22:33.420 are you allowed to list its contents 0:22:30.530,0:22:36.210 write for a directory is whether you are 0:22:33.420,0:22:39.090 allowed to rename create or remove files 0:22:36.210,0:22:42.030 within that directory so it's still kind 0:22:39.090,0:22:45.240 of right but notice that this means that 0:22:42.030,0:22:47.580 if you have write permissions on a file 0:22:45.240,0:22:49.950 but you do not have write permissions on 0:22:47.580,0:22:52.080 its directory you cannot delete the file 0:22:49.950,0:22:54.420 you can empty it but you cannot delete 0:22:52.080,0:22:57.660 it because that would require writing to 0:22:54.420,0:22:59.130 the directory itself and finally execute 0:22:57.660,0:23:01.950 on directories is something that trips 0:22:59.130,0:23:04.650 people up a lot execute on a directory 0:23:01.950,0:23:07.230 is what's known as search and that's not 0:23:04.650,0:23:10.200 terribly helpful a name but what that 0:23:07.230,0:23:13.470 means is are you allowed to enter this 0:23:10.200,0:23:15.240 directory if you want to get to a file 0:23:13.470,0:23:16.670 if you want to open it or read it or 0:23:15.240,0:23:20.310 write it whatever you want to do 0:23:16.670,0:23:22.710 basically to CD into a directory you 0:23:20.310,0:23:25.050 must have the execute permission on all 0:23:22.710,0:23:28.170 parent directories of that directory and 0:23:25.050,0:23:30.480 the directory itself so for example for 0:23:28.170,0:23:34.080 me to access a file inside slash user 0:23:30.480,0:23:35.820 slash bin such as user bin echo I must 0:23:34.080,0:23:38.100 have executed on route I must have 0:23:35.820,0:23:40.380 execute on user and I must have execute 0:23:38.100,0:23:42.120 on bin if I do not have all those 0:23:40.380,0:23:44.790 execute bits I will not be allowed to 0:23:42.120,0:23:48.410 access that file because I won't be able 0:23:44.790,0:23:50.670 to enter the directories along the way 0:23:48.410,0:23:52.560 there are a number of other bits that 0:23:50.670,0:23:55.320 you might come across like you might see 0:23:52.560,0:23:58.020 esses or T's in these lists you might 0:23:55.320,0:23:58.950 see LS those we can talk about in office 0:23:58.020,0:24:01.260 hours if you're curious 0:23:58.950,0:24:04.260 they will mostly not matter for anything 0:24:01.260,0:24:05.670 you will do in this class but they are 0:24:04.260,0:24:08.100 handy to know about so if you're curious 0:24:05.670,0:24:11.340 about them look them up on your own or 0:24:08.100,0:24:13.080 come ask us in office hours there are 0:24:11.340,0:24:14.580 some other programs that are handy to 0:24:13.080,0:24:16.200 know about oh sorry there's one more 0:24:14.580,0:24:17.400 thing as I mentioned if you just have a 0:24:16.200,0:24:19.470 dash it means you do not have that 0:24:17.400,0:24:21.810 permission right so if it says for 0:24:19.470,0:24:23.190 example our dash X it means that you 0:24:21.810,0:24:27.390 have read and execute but you do not 0:24:23.190,0:24:29.240 have right there are some other handy 0:24:27.390,0:24:32.360 programs to know about at this point 0:24:29.240,0:24:35.450 one of them is move or the MV command so 0:24:32.360,0:24:39.350 if I CD back to missing semester here MV 0:24:35.450,0:24:42.950 lets me rename a file and rename here 0:24:39.350,0:24:45.320 takes two paths it takes the old path in 0:24:42.950,0:24:47.870 the new path this is means that move 0:24:45.320,0:24:49.970 lets you both rename a file like if you 0:24:47.870,0:24:52.130 change the name of the file but not the 0:24:49.970,0:24:54.290 directory or it lets you move a file to 0:24:52.130,0:24:56.360 a completely different directory it just 0:24:54.290,0:24:57.890 you give the path to the current file 0:24:56.360,0:24:59.720 and the path to where you want that file 0:24:57.890,0:25:02.720 to be and that can change its location 0:24:59.720,0:25:05.480 and its name so for example I can move 0:25:02.720,0:25:09.020 dot files dot MD to be food MD 0:25:05.480,0:25:16.280 unhelpfully right and similarly I can 0:25:09.020,0:25:19.370 move it back there's also the CP command 0:25:16.280,0:25:21.860 the CP or copy is very similar it lets 0:25:19.370,0:25:23.750 you copy a file CP also takes two 0:25:21.860,0:25:25.610 arguments it takes the path you want to 0:25:23.750,0:25:28.340 copy from and the path you want to copy 0:25:25.610,0:25:30.890 to and these are full paths so I could 0:25:28.340,0:25:32.960 use this for example to say I want to 0:25:30.890,0:25:37.550 copy dot files out MD - dot dot slash 0:25:32.960,0:25:39.710 food MD sure food MD and now if I do LS 0:25:37.550,0:25:42.800 dot you'll see that there's a food MD 0:25:39.710,0:25:44.600 file in that directory so CP as well 0:25:42.800,0:25:47.780 take two paths it does not have to be in 0:25:44.600,0:25:49.700 the same directory and similarly there's 0:25:47.780,0:25:52.070 the RM command which lets you remove a 0:25:49.700,0:25:54.050 file and there - you can give paths in 0:25:52.070,0:25:56.750 this case I'm removing dot dot slash 0:25:54.050,0:25:59.480 food you should be aware for removing 0:25:56.750,0:26:01.940 especially on Linux removal is by 0:25:59.480,0:26:05.000 default not recursive so you cannot 0:26:01.940,0:26:07.100 remove a directory using RM you can pass 0:26:05.000,0:26:09.320 the - our flag which lets you do a 0:26:07.100,0:26:10.550 recursive remove and then give a path 0:26:09.320,0:26:12.890 that you want to remove and it will 0:26:10.550,0:26:16.370 remove everything below it there is also 0:26:12.890,0:26:18.290 the RM dr dir command which lets you 0:26:16.370,0:26:21.230 remove a directory but it only lets you 0:26:18.290,0:26:22.970 remove that directory if it is empty so 0:26:21.230,0:26:23.960 the idea here is to sort of be a safety 0:26:22.970,0:26:25.429 mechanism for you so you don't 0:26:23.960,0:26:28.610 accidentally throw away a bunch of your 0:26:25.429,0:26:31.040 files and the final little command 0:26:28.610,0:26:32.540 that's handy to use is make there which 0:26:31.040,0:26:34.429 lets you create a new directory and as 0:26:32.540,0:26:36.110 we talked about before you don't want to 0:26:34.429,0:26:37.940 do something like this because it will 0:26:36.110,0:26:40.580 create two directories for you one 0:26:37.940,0:26:42.140 called my and one called photos if you 0:26:40.580,0:26:42.980 actually want to create a directory like 0:26:42.140,0:26:50.120 this you would either 0:26:42.980,0:26:52.519 escape the space or quote the string if 0:26:50.120,0:26:54.919 you ever want more information about how 0:26:52.519,0:26:57.049 any command to basically on these 0:26:54.919,0:26:58.220 platforms work there's a really handy 0:26:57.049,0:27:00.649 command for that as well 0:26:58.220,0:27:04.610 there is the program called man for 0:27:00.649,0:27:06.409 manual pages this program takes as an 0:27:04.610,0:27:09.080 argument the name of another program and 0:27:06.409,0:27:12.019 gives you its manual page so for example 0:27:09.080,0:27:14.990 we could do man LS and this shows us a 0:27:12.019,0:27:16.730 manual page for LS you'll notice that in 0:27:14.990,0:27:19.250 the case of LS it is fairly similar to 0:27:16.730,0:27:20.870 what we got with LS - help but it's a 0:27:19.250,0:27:23.570 little easier to navigate a little 0:27:20.870,0:27:26.269 easier to read usually towards the 0:27:23.570,0:27:28.639 bottom you will also get examples 0:27:26.269,0:27:29.899 information about who wrote it where you 0:27:28.639,0:27:32.389 can find more information and that sort 0:27:29.899,0:27:32.990 of stuff one thing that can be confusing 0:27:32.389,0:27:35.330 sometimes 0:27:32.990,0:27:36.289 at least until a recent version where 0:27:35.330,0:27:38.779 they added this three at the bottom 0:27:36.289,0:27:41.389 which says Q to quit they do not use to 0:27:38.779,0:27:43.279 say this you press Q to quit this 0:27:41.389,0:27:48.169 program it can be really hard to quit it 0:27:43.279,0:27:50.750 if you do not know that a handy keyboard 0:27:48.169,0:27:52.970 shortcut here by the way is ctrl L which 0:27:50.750,0:27:56.990 lets you clear your terminal and go back 0:27:52.970,0:27:59.330 to the top so so far we've only talked 0:27:56.990,0:28:01.370 about programs in isolation but where 0:27:59.330,0:28:03.019 much of the power of the shell really 0:28:01.370,0:28:06.380 comes through is once you start 0:28:03.019,0:28:08.419 combining different programs right so 0:28:06.380,0:28:10.789 rather than just like running CDE 0:28:08.419,0:28:12.500 running LS and etc you might want to 0:28:10.789,0:28:13.940 chain multiple programs together you 0:28:12.500,0:28:15.980 might want to interact with files and 0:28:13.940,0:28:19.309 have files operate in between programs 0:28:15.980,0:28:21.200 and the way we can do this is using this 0:28:19.309,0:28:24.620 notion of streams that the shell gives 0:28:21.200,0:28:25.940 us every program by default has I'm 0:28:24.620,0:28:28.610 gonna simplify a little and say two 0:28:25.940,0:28:31.820 primary streams it has an input stream 0:28:28.610,0:28:33.950 and an output stream by default the 0:28:31.820,0:28:35.419 input stream is your keyboard basically 0:28:33.950,0:28:36.860 the input stream is your terminal and 0:28:35.419,0:28:38.929 whatever you type into your terminal is 0:28:36.860,0:28:40.610 going to end up into the program and it 0:28:38.929,0:28:42.049 has a default output stream which is 0:28:40.610,0:28:44.330 whenever the program prints something 0:28:42.049,0:28:46.279 it's gonna print to that stream and by 0:28:44.330,0:28:48.470 default that is also your terminal this 0:28:46.279,0:28:50.690 is why when I type echo hello it gets 0:28:48.470,0:28:54.200 printed back to my terminal but the 0:28:50.690,0:28:56.360 shell gives you a way to rewire these 0:28:54.200,0:28:59.120 streams to change where the input 0:28:56.360,0:29:00.980 output of a programmer pointed the way 0:28:59.120,0:29:06.200 the most straightforward way you do this 0:29:00.980,0:29:08.210 is using the angle bracket signs so you 0:29:06.200,0:29:11.570 can write something like this or you can 0:29:08.210,0:29:14.299 write something like this the left angle 0:29:11.570,0:29:16.340 bracket indicates rewire the input for 0:29:14.299,0:29:21.040 this program to be the contents of this 0:29:16.340,0:29:23.600 file and the end angle bracket means 0:29:21.040,0:29:27.559 rewire the output of the preceding 0:29:23.600,0:29:28.580 program into this file so let's look at 0:29:27.559,0:29:32.240 an example of what that would look like 0:29:28.580,0:29:34.280 if I do echo hello I can say I want that 0:29:32.240,0:29:36.710 context the content to be stored in a 0:29:34.280,0:29:39.049 file called hello dot text and because I 0:29:36.710,0:29:40.520 gave this is a relative path right this 0:29:39.049,0:29:42.980 will construct a file in the current 0:29:40.520,0:29:45.440 directory called hello text and at least 0:29:42.980,0:29:47.780 in theory its contents should be the 0:29:45.440,0:29:50.360 word hello so if I run this notice that 0:29:47.780,0:29:52.100 nothing got printed to my output the 0:29:50.360,0:29:52.700 previous time when I ran echo hello it 0:29:52.100,0:29:55.340 printed hello 0:29:52.700,0:29:57.799 now that hello is going gone into a file 0:29:55.340,0:30:00.610 called hello text and I can verify this 0:29:57.799,0:30:03.860 by using the program called cat so cat 0:30:00.610,0:30:07.280 prints the contents of a file so I can 0:30:03.860,0:30:11.059 do cat hello dot txt and there it shows 0:30:07.280,0:30:13.220 me hello but cat is a is also something 0:30:11.059,0:30:16.220 that supports this kind of wiring so I 0:30:13.220,0:30:17.990 can say cat which by default just prints 0:30:16.220,0:30:20.720 its input it just duplicates its input 0:30:17.990,0:30:23.809 to its output I can say I want you to 0:30:20.720,0:30:25.160 take your input from Hello text what 0:30:23.809,0:30:26.990 will happen in this case is that the 0:30:25.160,0:30:29.840 shell is going to open hello dot txt 0:30:26.990,0:30:32.540 take its contents and set that to be the 0:30:29.840,0:30:34.370 input of cat and then cat is going to 0:30:32.540,0:30:36.500 just print that to its output which 0:30:34.370,0:30:38.179 since I haven't rewired it is gonna be 0:30:36.500,0:30:41.870 my terminal so this will just print 0:30:38.179,0:30:43.549 hello to the output and I can use both 0:30:41.870,0:30:45.470 of these at the same time so for example 0:30:43.549,0:30:47.000 if I want to copy a file and I don't 0:30:45.470,0:30:51.500 want to use the CP command for some 0:30:47.000,0:30:54.470 reason I can do this and in this case 0:30:51.500,0:30:56.540 I'm telling the cat program nothing at 0:30:54.470,0:30:58.010 all I'm just saying do your normal thing 0:30:56.540,0:30:59.960 right the cat program does not know 0:30:58.010,0:31:02.150 anything about this redirection but I'm 0:30:59.960,0:31:04.190 telling the shell to use hello dot txt as 0:31:02.150,0:31:08.120 the input for cat and to write anything 0:31:04.190,0:31:09.470 that cat prints - hello - dot txt again 0:31:08.120,0:31:10.010 this prints nothing to my terminal 0:31:09.470,0:31:13.340 but if 0:31:10.010,0:31:15.620 cat hello to text I get the output as I 0:31:13.340,0:31:20.630 would have expected which is a copy of 0:31:15.620,0:31:23.390 the original file there is also a double 0:31:20.630,0:31:26.570 end bracket which is append instead of 0:31:23.390,0:31:27.380 just overwrite so you'll notice that I 0:31:26.570,0:31:29.870 if I do 0:31:27.380,0:31:32.300 cat hello dot txt - hello - dot txt 0:31:29.870,0:31:34.160 again and then I cat hello2 dot txt it 0:31:32.300,0:31:36.500 still just contains hello even though it 0:31:34.160,0:31:38.750 already contained hello if I switch that 0:31:36.500,0:31:41.090 to instead be a double end bracket it 0:31:38.750,0:31:45.890 means append and if I now cat that file 0:31:41.090,0:31:47.570 it has a hello twice these are pretty 0:31:45.890,0:31:49.850 straightforward they're usually just 0:31:47.570,0:31:51.590 ways to interact with files but where it 0:31:49.850,0:31:53.420 gets really interesting is an additional 0:31:51.590,0:31:56.150 operator the shell gives you called the 0:31:53.420,0:32:00.020 pipe character so pipe is just a 0:31:56.150,0:32:02.900 vertical bar and what pipe means is take 0:32:00.020,0:32:05.300 the output of the program to the left 0:32:02.900,0:32:09.650 and make it the input of the program to 0:32:05.300,0:32:13.940 the right right so what does this look 0:32:09.650,0:32:17.450 like well let's take the example of ls / 0:32:13.940,0:32:19.550 or ls dash l / this prints a bunch of 0:32:17.450,0:32:22.460 things let's say that I only wanted the 0:32:19.550,0:32:25.670 last line of this output well there's a 0:32:22.460,0:32:28.940 command called tail and tail prints the 0:32:25.670,0:32:32.420 last n lines of its input and I can do 0:32:28.940,0:32:34.520 -n1 so this is a flag called n you 0:32:32.420,0:32:36.890 can also use dash dash lines if you want 0:32:34.520,0:32:38.660 to use it as a longer option but in this 0:32:36.890,0:32:42.260 case this is saying just print the last 0:32:38.660,0:32:46.640 line and I can wire these together so I 0:32:42.260,0:32:50.840 can say ls dash l / pipe tail -n1 0:32:46.640,0:32:53.060 and notice here that ls does not know 0:32:50.840,0:32:55.340 about tail and tail does not know about 0:32:53.060,0:32:56.870 ls they are different programs and have 0:32:55.340,0:32:59.120 never been programmed to be compatible 0:32:56.870,0:33:00.650 with one another all they know how to do 0:32:59.120,0:33:02.900 is read from input and write to output 0:33:00.650,0:33:05.360 and then the pipe is what wires them 0:33:02.900,0:33:07.670 together and in this particular case I'm 0:33:05.360,0:33:09.380 saying I want the output of LS to be the 0:33:07.670,0:33:10.850 input to tail and then I want the output 0:33:09.380,0:33:12.140 of tail to just go to my terminal 0:33:10.850,0:33:14.240 because I haven't rewired it 0:33:12.140,0:33:16.730 I could also rewire this to say I want 0:33:14.240,0:33:18.770 the output to go to ls dot text and in this 0:33:16.730,0:33:20.990 case if I cat ls dot text I would get 0:33:18.770,0:33:22.640 the appropriate output and it turns out 0:33:20.990,0:33:21.815 you can do some really neat things with this 0:33:23.340,0:33:27.720 gonna cover this a lot more in the data 0:33:25.110,0:33:30.720 wrangling lecture there will be in like 0:33:27.720,0:33:32.490 four days or something on the kind of 0:33:30.720,0:33:36.060 fancy stuff you can do when you start 0:33:32.490,0:33:37.560 building more advanced pipelines one to 0:33:36.060,0:33:42.300 give you one example we can do something 0:33:37.560,0:33:46.320 like curl - -head --silent google.com 0:33:42.300,0:33:48.870 so just to show you what that looks 0:33:46.320,0:33:52.680 like this gives me all the HTTP headers 0:33:48.870,0:33:56.520 for accessing google.com and I can pipe 0:33:52.680,0:34:01.260 that to grep a - like a --ignore-case 0:33:56.520,0:34:04.230 or just -i if I want content 0:34:01.260,0:34:06.120 length so this is gonna print the 0:34:04.230,0:34:07.500 content length header, grep is a program 0:34:06.120,0:34:09.090 that we'll talk about later they'll let 0:34:07.500,0:34:12.660 you search in an input stream for a 0:34:09.090,0:34:15.560 given keyword we can pipe that through 0:34:12.660,0:34:20.190 say the cut command which takes a 0:34:15.560,0:34:22.260 delimiter set that to be space and I 0:34:20.190,0:34:24.420 want the second field and this prints 0:34:22.260,0:34:25.950 just the content length this is sort of 0:34:24.420,0:34:28.380 a silly example right like this just 0:34:25.950,0:34:30.180 lets you extract the content length in 0:34:28.380,0:34:32.700 bytes of google.com from the command 0:34:30.180,0:34:34.740 line it's not a very useful thing to do 0:34:32.700,0:34:36.300 but you can see how by chaining these 0:34:34.740,0:34:38.330 together you can achieve a bunch of 0:34:36.300,0:34:40.980 really interesting text manipulation 0:34:38.330,0:34:43.290 effects and it turns out pipes are not 0:34:40.980,0:34:45.330 just for textual data you can do this 0:34:43.290,0:34:47.850 for things like images as well you can 0:34:45.330,0:34:49.590 have a program that manipulates a binary 0:34:47.850,0:34:51.450 image on its input and writes a binary 0:34:49.590,0:34:53.400 image to its output and you can chain 0:34:51.450,0:34:54.840 them together in this way and we'll talk 0:34:53.400,0:34:57.000 about some of those kinds of examples 0:34:54.840,0:34:59.430 later on - you can even do this for 0:34:57.000,0:35:00.900 video if you want you can stream this is 0:34:59.430,0:35:02.940 for example a great way if you have a 0:35:00.900,0:35:05.790 chromecast at home you can stream a 0:35:02.940,0:35:07.920 video file like this by having the last 0:35:05.790,0:35:11.160 program in your pipe be a chromecast 0:35:07.920,0:35:13.050 send program so you stream a video file 0:35:11.160,0:35:19.140 into it and it streams or HTTP to your 0:35:13.050,0:35:20.370 chromecast we'll take we'll talk a lot 0:35:19.140,0:35:22.410 more about this in the data wrangling 0:35:20.370,0:35:25.110 lecture but there's one more thing that 0:35:22.410,0:35:27.800 I wanted to talk to you about about sort 0:35:25.110,0:35:30.390 of how to use the terminal and a more 0:35:27.800,0:35:31.920 interesting and perhaps more powerful 0:35:30.390,0:35:33.840 way that you might be used to and this 0:35:31.920,0:35:35.640 is perhaps even going to be interesting 0:35:33.840,0:35:37.720 for the ones of you who feel like you're 0:35:35.640,0:35:41.020 already comfortable with the term 0:35:37.720,0:35:43.030 but first we need to cover a important 0:35:41.020,0:35:44.890 topic when it comes to Linux systems and 0:35:43.030,0:35:47.620 Mac OS systems in particular which is 0:35:44.890,0:35:49.300 the notion of the root user the root 0:35:47.620,0:35:52.480 user is sort of like the administrator 0:35:49.300,0:35:55.000 user on Windows and it has user IDs zero 0:35:52.480,0:35:56.830 the root user is special because it is 0:35:55.000,0:35:59.680 allowed to do whatever it wants on your 0:35:56.830,0:36:01.540 system even if a file is like not 0:35:59.680,0:36:03.790 readable by anyone or if it's not 0:36:01.540,0:36:06.010 writable by anyone root can still access 0:36:03.790,0:36:09.000 that file root is sort of a super user 0:36:06.010,0:36:11.260 that gets to do whatever they want and 0:36:09.000,0:36:13.330 most of the time you will not be 0:36:11.260,0:36:15.550 operating as the super user you will not 0:36:13.330,0:36:17.350 be root you will be a user like John or 0:36:15.550,0:36:19.660 whatever your name is and that's going 0:36:17.350,0:36:21.370 to be the user you act with because if 0:36:19.660,0:36:23.470 you were operating your computer as the 0:36:21.370,0:36:24.700 root user at all times if you ran the 0:36:23.470,0:36:26.710 wrong program they could just completely 0:36:24.700,0:36:29.950 destroy your computer and you don't want 0:36:26.710,0:36:31.810 that right but every now and again you 0:36:29.950,0:36:34.450 want to do something that requires that 0:36:31.810,0:36:38.580 you are root usually for these cases you 0:36:34.450,0:36:42.790 will use a program called sudo su do or 0:36:38.580,0:36:44.740 do as su and su in this case is Super 0:36:42.790,0:36:46.590 User so this is a way to do the 0:36:44.740,0:36:49.750 following thing as the super user 0:36:46.590,0:36:51.490 usually the way sudo works is you write 0:36:49.750,0:36:53.020 sudo and then a command like you would 0:36:51.490,0:36:54.580 normally on your terminal and it will 0:36:53.020,0:36:56.230 just run that command as if you were 0:36:54.580,0:37:01.180 root as opposed to the user you actually 0:36:56.230,0:37:04.540 are where might you need something like 0:37:01.180,0:37:05.800 this well there is a special there are 0:37:04.540,0:37:07.510 many special file system on your 0:37:05.800,0:37:11.070 computer but in particular there's one 0:37:07.510,0:37:14.800 called sysfs if you CD to slash sys 0:37:11.070,0:37:17.320 this is a whole new world this file 0:37:14.800,0:37:19.720 system is are not actually files on your 0:37:17.320,0:37:22.120 computer instead these are various 0:37:19.720,0:37:24.180 kernel parameters so the kernel is like 0:37:22.120,0:37:26.680 basically the the core of your computer 0:37:24.180,0:37:29.560 this is a way for you to access various 0:37:26.680,0:37:32.680 kernel parameters through what looks 0:37:29.560,0:37:35.950 like a file system you'll see here that 0:37:32.680,0:37:37.690 if I CD into class for example it has 0:37:35.950,0:37:39.880 directories for a bunch of different 0:37:37.690,0:37:43.750 types of devices that I can interact 0:37:39.880,0:37:47.920 with or various queues I can access or all 0:37:43.750,0:37:49.990 sorts of weird knobs internally and 0:37:47.920,0:37:50.410 because they're exposed as files it means 0:37:50.410,0:37:54.280 we can also use all the tools have been 0:37:52.030,0:37:57.579 using so far in order to manipulate them 0:37:54.280,0:38:01.420 one example of this is if you go into 0:37:57.579,0:38:02.440 sys class backlight so this backlight 0:38:01.420,0:38:04.180 directly and lets you configure the 0:38:02.440,0:38:06.760 backlight on your laptop if you have one 0:38:04.180,0:38:08.920 so I can CD in to intel backlight this 0:38:06.760,0:38:10.990 is an Intel laptop inside here you'll 0:38:08.920,0:38:12.760 see there's a file called brightness and 0:38:10.990,0:38:16.089 I can cat the brightness this is the 0:38:12.760,0:38:18.880 current brightness of my screen but not 0:38:16.089,0:38:21.460 only that I can modify this too in order 0:38:18.880,0:38:23.740 to change the brightness of my screen so 0:38:21.460,0:38:25.750 you might think that I could do let's 0:38:23.740,0:38:26.799 see what the max brightness is here okay 0:38:25.750,0:38:29.589 so it's currently set to the max 0:38:26.799,0:38:32.319 brightness you might imagine that I 0:38:29.589,0:38:35.410 could do something like if I do echo 0:38:32.319,0:38:39.010 let's do half or something 0:38:35.410,0:38:38.010 echo 500 to brightness 0:38:38.010,0:38:39.010 if I do this it says 0:38:39.010,0:38:43.089 permission denied I'm not allowed to 0:38:40.839,0:38:45.220 modify brightness because in order to 0:38:43.089,0:38:46.599 basically in order to change things in 0:38:45.220,0:38:48.460 the kernel you need to be the 0:38:46.599,0:38:50.619 administrator and you might imagine that 0:38:48.460,0:38:52.960 the way to solve this is to write sudo 0:38:50.619,0:38:55.779 echo 500 but I still get a permission 0:38:52.960,0:38:58.260 denied error but why is that it's 0:38:55.779,0:39:00.549 because as I mentioned before these 0:38:58.260,0:39:03.069 redirections of input and output is not 0:39:00.549,0:39:05.470 something the programs know about when 0:39:03.069,0:39:07.240 we piped Elison to tail tail did not 0:39:05.470,0:39:09.609 know about LS and LS did not know about 0:39:07.240,0:39:11.859 tail the pipe and the redirection was 0:39:09.609,0:39:14.079 set up by the shell so in this case 0:39:11.859,0:39:18.039 what's happening is I'm telling my shell 0:39:14.079,0:39:21.220 run the program sudo with the arguments 0:39:18.039,0:39:24.130 echo and 500 and send its output to the 0:39:21.220,0:39:25.930 file called brightness but the shell is 0:39:24.130,0:39:29.410 what is opening the brightness file it 0:39:25.930,0:39:32.380 is not the sudo program so in this case 0:39:29.410,0:39:33.789 the shell which is running as me tries 0:39:32.380,0:39:35.470 to open the brightness file for writing 0:39:33.789,0:39:37.079 and it's not allowed to do that and 0:39:35.470,0:39:39.779 therefore I get a permission down error 0:39:37.079,0:39:42.339 you might have seen this if you like 0:39:39.779,0:39:43.750 search for something end up on Stack 0:39:42.339,0:39:45.400 Overflow and it tells just run this 0:39:43.750,0:39:47.440 command and you'll see that it does 0:39:45.400,0:39:52.930 something like they give you 0:39:47.440,0:39:57.970 instructions like one two sis what's an 0:39:52.930,0:39:59.559 example net ipv4 for word for example 0:39:57.970,0:40:02.589 this is something you may have seen if 0:39:59.559,0:40:04.240 you're setting up a firewall and this 0:40:02.589,0:40:05.680 command is intended to work 0:40:04.240,0:40:08.200 because this little pound symbol 0:40:05.680,0:40:09.640 indicates run this as root this is 0:40:08.200,0:40:11.170 something that is very rarely explained 0:40:09.640,0:40:12.970 but that is what the pound symbol means 0:40:11.170,0:40:15.099 you'll see on my prompt there's a dollar 0:40:12.970,0:40:17.710 symbol instead and the dollar indicates 0:40:15.099,0:40:18.819 you are not running as root so the 0:40:17.710,0:40:22.270 question is how do I get around this 0:40:18.819,0:40:24.690 well I could switch into a root terminal 0:40:22.270,0:40:27.369 so one way to do this is to run sudo su 0:40:24.690,0:40:32.140 sudo su is saying run the following 0:40:27.369,0:40:34.329 command s root and su is a complicated 0:40:32.140,0:40:37.290 command that effectively gets you a 0:40:34.329,0:40:40.599 shell as the super user so if I do this 0:40:37.290,0:40:42.010 type of password then now you'll see 0:40:40.599,0:40:44.530 that the username at the beginning 0:40:42.010,0:40:47.109 changed from jon to root and the prompt 0:40:44.530,0:40:49.390 changed from a dollar to a pound if I 0:40:47.109,0:40:52.240 now I come in to that file if I do echo 0:40:49.390,0:40:54.010 500 to brightness my screen got a little 0:40:52.240,0:40:57.040 dimmer but you can't see it you just 0:40:54.010,0:40:58.990 have to trust me and now I didn't get an 0:40:57.040,0:41:01.630 error and this is because the shell is 0:40:58.990,0:41:04.540 now running as root it is not running as 0:41:01.630,0:41:07.359 Jon and the root user is allowed to open 0:41:04.540,0:41:09.760 this file but given our knowledge that 0:41:07.359,0:41:11.349 we have of the terminal now there's 0:41:09.760,0:41:13.720 actually a way for us to do this without 0:41:11.349,0:41:19.119 having to drop to a root shell and that 0:41:13.720,0:41:22.990 is as follows that's I guess restore it 0:41:19.119,0:41:26.589 to 1060 so do you see why this is 0:41:22.990,0:41:29.020 different here I'm telling my shell to 0:41:26.589,0:41:31.270 run the echo 1060 command which is gonna 0:41:29.020,0:41:33.369 echo 1060 and I'm telling it to run the 0:41:31.270,0:41:35.890 sudo tee brightness command and I'm 0:41:33.369,0:41:39.160 telling you to send the output of echo 0:41:35.890,0:41:40.540 into sudo tee in order to understand this 0:41:39.160,0:41:43.450 you need to know what the tee command does 0:41:40.540,0:41:47.079 the tee command takes its input and writes 0:41:43.450,0:41:49.540 it to a file but also to standard out so 0:41:47.079,0:41:52.329 tee is a convenient way if you have say a 0:41:49.540,0:41:54.160 log file that you want to like send to a 0:41:52.329,0:41:56.230 file to store for later but you also 0:41:54.160,0:41:58.059 want to see it to yourself then you can 0:41:56.230,0:41:59.770 pipe it through tee give it the name of a 0:41:58.059,0:42:01.809 file and it will write whatever its 0:41:59.770,0:42:04.270 input is both to that file and to your 0:42:01.809,0:42:07.630 screen and here I'm taking advantage of 0:42:04.270,0:42:09.940 that program I'm saying run tee as route 0:42:07.630,0:42:12.970 and have tee right into the brightness 0:42:09.940,0:42:14.380 file and so in this case the tee program 0:42:12.970,0:42:16.150 which is what is opening the brightness 0:42:14.380,0:42:17.370 file is running as root and so it is 0:42:16.150,0:42:20.190 allowed to do 0:42:17.370,0:42:21.390 if I run this it will now again you 0:42:20.190,0:42:23.850 can't see but the brightness and I've 0:42:21.390,0:42:25.770 been turned on by a laptop and I don't 0:42:23.850,0:42:27.390 get any errors and I never had to drop 0:42:25.770,0:42:30.930 into a root shell and run commands there 0:42:27.390,0:42:32.160 which can often be somewhat dangerous if 0:42:30.930,0:42:33.450 you want to explore this filesystem a 0:42:32.160,0:42:35.940 little bit more there's a lot of 0:42:33.450,0:42:39.450 interesting stuff in here if you just 0:42:35.940,0:42:41.430 sort of start browsing around you can 0:42:39.450,0:42:42.930 find all sorts of fun things so for 0:42:41.430,0:42:45.090 example we noticed that there was a fun 0:42:42.930,0:42:48.540 brightness command here I wonder what 0:42:45.090,0:42:49.980 other kinds of brightness I can set so I 0:42:48.540,0:42:51.860 can use the find command which we will 0:42:49.980,0:42:56.000 also talk about in a coming lecture I 0:42:51.860,0:42:58.860 wouldn't look on any file whose name 0:42:56.000,0:43:01.890 it's a little like brightness in the 0:42:58.860,0:43:05.070 current directory that's unhelpful maybe 0:43:01.890,0:43:08.850 they're not files did I misspell 0:43:05.070,0:43:17.010 brightness yeah why is it being annoying 0:43:08.850,0:43:20.460 Oh apparently it does not want to search 0:43:17.010,0:43:23.910 for brightness for me how well luckily 0:43:20.460,0:43:27.480 for you I know of one already handy that 0:43:23.910,0:43:30.090 there is a subdirectory called LEDs and 0:43:27.480,0:43:32.400 LEDs have brightness too what kind of 0:43:30.090,0:43:36.960 LEDs are there ooh lots of things for 0:43:32.400,0:43:38.280 example the scroll lock led now most of 0:43:36.960,0:43:40.290 you probably don't know what the scroll 0:43:38.280,0:43:42.780 lock LED is or much less what scroll 0:43:40.290,0:43:45.770 lock is you might have seen a key on 0:43:42.780,0:43:47.670 your keyboard neighbor named scroll lock 0:43:45.770,0:43:49.650 basically no one knows what it means 0:43:47.670,0:43:51.750 anymore no one really uses it for 0:43:49.650,0:43:55.680 anything it's mostly just a dead key and 0:43:51.750,0:43:57.240 also a dead LED what if you wanted to 0:43:55.680,0:43:59.220 configure it so that every time you get 0:43:57.240,0:44:00.960 email your scroll lock LED lights up 0:43:59.220,0:44:03.270 because there's no other reason why it 0:44:00.960,0:44:06.000 would light up well if we seed you into 0:44:03.270,0:44:08.130 this particular directory that has a 0:44:06.000,0:44:12.320 brightness place and it's set to zero 0:44:08.130,0:44:12.320 well what happens if I write one into it 0:44:12.590,0:44:17.220 you probably should not just be writing 0:44:15.330,0:44:18.720 random numbers into random files in this 0:44:17.220,0:44:20.310 directory because you are affecting your 0:44:18.720,0:44:22.560 kernel directly like look up what the 0:44:20.310,0:44:24.240 files do in this particular case I have 0:44:22.560,0:44:28.050 warned safety goggles and I've done my 0:44:24.240,0:44:30.630 research so now you can't tell but on my 0:44:28.050,0:44:33.509 keyboard the scroll lock LED is now lit 0:44:30.630,0:44:35.400 so now if I wrote a program that like 0:44:33.509,0:44:37.829 did some checking of mail and stuff I 0:44:35.400,0:44:40.229 could have it at the end run a program 0:44:37.829,0:44:43.499 that echoes one into this file and now I 0:44:40.229,0:44:47.460 have a way for my led to my keyboard to 0:44:43.499,0:44:49.680 indicate when I've new email at this 0:44:47.460,0:44:50.940 point you should know roughly your way 0:44:49.680,0:44:54.269 around 0:44:50.940,0:44:56.249 the terminal around the shell and and 0:44:54.269,0:44:58.920 know enough to accomplish these basic 0:44:56.249,0:45:01.289 tasks at least in theory now you 0:44:58.920,0:45:02.819 shouldn't need to use like 0:45:01.289,0:45:03.420 point-and-click interfaces to find files 0:45:02.819,0:45:05.279 anymore 0:45:03.420,0:45:07.470 there's one remaining trick you might 0:45:05.279,0:45:10.529 need and that is the ability to open a 0:45:07.470,0:45:13.950 file so far I've only really given you 0:45:10.529,0:45:17.690 ways to find files but one thing you 0:45:13.950,0:45:21.420 should know about is missing semester 0:45:17.690,0:45:23.640 xdg-open this will probably only work 0:45:21.420,0:45:27.119 on Linux on Mac OS I think it's just 0:45:23.640,0:45:29.430 called open on Windows who knows 0:45:27.119,0:45:31.739 xdg-open you give the name of a file and 0:45:29.430,0:45:34.769 it will open it in the appropriate program 0:45:31.739,0:45:36.180 so if you open if you do xdg-open an 0:45:34.769,0:45:39.269 HTML file that will open your browser 0:45:36.180,0:45:41.039 and open that file and once you have 0:45:39.269,0:45:42.869 that program in theory you should no 0:45:41.039,0:45:45.059 longer need to open like a Finder window 0:45:42.869,0:45:46.799 ever again you might want to for other 0:45:45.059,0:45:48.180 reasons but in theory you can accomplish 0:45:46.799,0:45:50.789 at all using the tools that we've 0:45:48.180,0:45:53.849 learned today this might all seem 0:45:50.789,0:45:55.589 relatively basic for some of you but as 0:45:53.849,0:45:57.479 I mentioned this is sort of the ramp-up 0:45:55.589,0:45:59.460 period of now we all know how the shell 0:45:57.479,0:46:01.979 works and a lot of what we'll be doing 0:45:59.460,0:46:03.450 in future lectures is using this 0:46:01.979,0:46:07.019 knowledge to do really interesting 0:46:03.450,0:46:09.450 things using the shell that sort of this 0:46:07.019,0:46:10.979 is learning the the interface that we're 0:46:09.450,0:46:14.849 going to be using and so it's important 0:46:10.979,0:46:16.650 we all know it we're gonna talk a lot 0:46:14.849,0:46:18.269 more in the next lecture about how to 0:46:16.650,0:46:20.309 automate tasks like this how to write 0:46:18.269,0:46:22.140 scripts that run a bunch of programs for 0:46:20.309,0:46:24.390 you and have to do things like 0:46:22.140,0:46:26.700 conditionals and loops and stuff in your 0:46:24.390,0:46:29.009 terminal and do things like run a 0:46:26.700,0:46:30.390 program until it fails which can be 0:46:29.009,0:46:31.979 handy in classes where you want to run 0:46:30.390,0:46:35.369 something until your test suite fails 0:46:31.979,0:46:38.550 for example so that's the topic for next 0:46:35.369,0:46:39.900 week's lecture did you have a question 0:46:38.550,0:46:42.420 it's what you've been demoing this 0:46:39.900,0:46:49.770 assist directory that presumably will 0:46:42.420,0:46:52.530 only work if you're running that is a 0:46:49.770,0:46:55.440 good question I don't know whether the 0:46:52.530,0:46:57.570 windows subsystem for Linux will expose 0:46:55.440,0:46:59.280 the sis file system if it does it 0:46:57.570,0:47:03.180 probably only exposes a very small 0:46:59.280,0:47:08.490 number of things it might because there 0:47:03.180,0:47:10.320 are I don't know check it out 0:47:08.490,0:47:11.610 one thing you'll see is the lecture 0:47:10.320,0:47:14.370 notes for this lecture are already 0:47:11.610,0:47:16.770 online and at the very bottom of the 0:47:14.370,0:47:18.420 file there are a bunch of exercises some 0:47:16.770,0:47:20.190 of them are relatively easy some of them 0:47:18.420,0:47:22.560 are a little bit harder and what we 0:47:20.190,0:47:24.060 encourage you to do is to take a stab at 0:47:22.560,0:47:25.410 going through them if you know this 0:47:24.060,0:47:27.660 stuff already it should go really 0:47:25.410,0:47:29.400 quickly if you don't it might teach you 0:47:27.660,0:47:31.740 a bunch of things that you might not 0:47:29.400,0:47:33.150 realize you didn't know and for the 0:47:31.740,0:47:35.190 office hours that we're gonna do right 0:47:33.150,0:47:36.840 after this lecture we will happily help 0:47:35.190,0:47:38.160 you get through all of those or if there 0:47:36.840,0:47:39.540 are other commands and you learn in the 0:47:38.160,0:47:42.300 process you want to know how to use more 0:47:39.540,0:47:44.910 efficiently and then in next lecture 0:47:42.300,0:47:46.710 which is tomorrow will basically be 0:47:44.910,0:47:48.290 assuming that you know the kind of stuff 0:47:46.710,0:47:51.750 that the exercise is going to teach you 0:47:48.290,0:47:53.030 there's also a an email address on the 0:47:51.750,0:47:56.100 website where you can send us questions 0:47:53.030,0:47:58.860 if you think of something like after the 0:47:56.100,0:48:05.160 office hours are finished are there any 0:47:58.860,0:48:07.050 questions before we end today no no all 0:48:05.160,0:48:09.480 right well we will have office hours on 0:48:07.050,0:48:12.150 the ninth floor of the gates building of 0:48:09.480,0:48:15.830 building 32 in like five minutes 0:48:12.150,0:48:15.830 sweet see you there