[Script Info] Title: [Events] Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text Dialogue: 0,0:00:00.65,0:00:07.80,Default,,0000,0000,0000,,all right everyone thanks for coming in. Dialogue: 0,0:00:02.43,0:00:07.80,Default,,0000,0000,0000,,This is the missing semester of your CS Education; Dialogue: 0,0:00:07.80,0:00:11.52,Default,,0000,0000,0000,,at least that's what we chose to call Dialogue: 0,0:00:09.96,0:00:13.68,Default,,0000,0000,0000,,the class. if you're not here for this Dialogue: 0,0:00:11.52,0:00:15.90,Default,,0000,0000,0000,,class then you're in the wrong room. We Dialogue: 0,0:00:13.68,0:00:19.59,Default,,0000,0000,0000,,will be here for about an hour just to Dialogue: 0,0:00:15.90,0:00:21.18,Default,,0000,0000,0000,,set your expectations and I want to talk Dialogue: 0,0:00:19.59,0:00:23.79,Default,,0000,0000,0000,,to you a little bit first about why Dialogue: 0,0:00:21.18,0:00:25.98,Default,,0000,0000,0000,,we're doing this class. So this class Dialogue: 0,0:00:23.79,0:00:29.67,Default,,0000,0000,0000,,stems out of an observation that Anish Dialogue: 0,0:00:25.98,0:00:33.03,Default,,0000,0000,0000,,and Jose and I have made while TA-ing various Dialogue: 0,0:00:29.67,0:00:34.71,Default,,0000,0000,0000,,classes at MIT which is that basically Dialogue: 0,0:00:31.32,0:00:34.71,Default,,0000,0000,0000,,all of us computer scientists, we know Dialogue: 0,0:00:34.71,0:00:38.37,Default,,0000,0000,0000,,that computers are great at doing these Dialogue: 0,0:00:36.42,0:00:41.25,Default,,0000,0000,0000,,repetitive tasks and automating things Dialogue: 0,0:00:38.37,0:00:43.02,Default,,0000,0000,0000,,but we often fail to realize that there Dialogue: 0,0:00:41.25,0:00:45.93,Default,,0000,0000,0000,,are lots of tools that can make our own Dialogue: 0,0:00:43.02,0:00:47.52,Default,,0000,0000,0000,,development processes better. We can be a Dialogue: 0,0:00:45.93,0:00:49.62,Default,,0000,0000,0000,,lot more efficient about how we use our Dialogue: 0,0:00:47.52,0:00:51.99,Default,,0000,0000,0000,,computers because we can use the Dialogue: 0,0:00:49.62,0:00:54.36,Default,,0000,0000,0000,,computer as a tool for ourselves not Dialogue: 0,0:00:51.99,0:00:57.81,Default,,0000,0000,0000,,just for building websites or software Dialogue: 0,0:00:54.36,0:00:59.67,Default,,0000,0000,0000,,those sorts of things and this class is Dialogue: 0,0:00:57.81,0:01:03.00,Default,,0000,0000,0000,,an attempt to address - this is an attempt Dialogue: 0,0:00:59.67,0:01:05.22,Default,,0000,0000,0000,,to show you some of the tools that you Dialogue: 0,0:01:03.00,0:01:07.64,Default,,0000,0000,0000,,can use to great effect in your day to Dialogue: 0,0:01:05.22,0:01:11.67,Default,,0000,0000,0000,,day in your research and in your studies Dialogue: 0,0:01:07.64,0:01:15.15,Default,,0000,0000,0000,,and it's going to be a class where we Dialogue: 0,0:01:10.38,0:01:15.15,Default,,0000,0000,0000,,want you to teach you both how to make Dialogue: 0,0:01:15.15,0:01:19.20,Default,,0000,0000,0000,,the most of the tools that you already Dialogue: 0,0:01:16.44,0:01:20.91,Default,,0000,0000,0000,,know but also hopefully teach you about Dialogue: 0,0:01:19.20,0:01:23.52,Default,,0000,0000,0000,,some tools so you don't know from before Dialogue: 0,0:01:20.91,0:01:26.25,Default,,0000,0000,0000,,and how to combine those tools to Dialogue: 0,0:01:23.52,0:01:28.14,Default,,0000,0000,0000,,produce more powerful things than you Dialogue: 0,0:01:26.25,0:01:31.05,Default,,0000,0000,0000,,think you might be able to do with what Dialogue: 0,0:01:28.14,0:01:33.42,Default,,0000,0000,0000,,you know today the class is going to be Dialogue: 0,0:01:31.05,0:01:36.63,Default,,0000,0000,0000,,structured as a series of 11 one-hour Dialogue: 0,0:01:33.42,0:01:38.88,Default,,0000,0000,0000,,lectures and each one is going to cover Dialogue: 0,0:01:36.63,0:01:40.92,Default,,0000,0000,0000,,a particular topic you can see the Dialogue: 0,0:01:38.88,0:01:43.44,Default,,0000,0000,0000,,website which is also listed there for Dialogue: 0,0:01:40.92,0:01:45.99,Default,,0000,0000,0000,,the list of lecture topics and what date Dialogue: 0,0:01:43.44,0:01:48.21,Default,,0000,0000,0000,,will do each one they will mostly be Dialogue: 0,0:01:45.99,0:01:49.35,Default,,0000,0000,0000,,independent and so you can sort of show Dialogue: 0,0:01:48.21,0:01:51.45,Default,,0000,0000,0000,,up for the ones that you're interested Dialogue: 0,0:01:49.35,0:01:53.61,Default,,0000,0000,0000,,in but we will sort of assume that Dialogue: 0,0:01:51.45,0:01:55.65,Default,,0000,0000,0000,,you've been following along so that as Dialogue: 0,0:01:53.61,0:01:57.03,Default,,0000,0000,0000,,we get to later lectures I'm not going Dialogue: 0,0:01:55.65,0:02:02.28,Default,,0000,0000,0000,,to be teaching you bash all over again Dialogue: 0,0:01:57.03,0:02:05.31,Default,,0000,0000,0000,,for example we we are also going to post Dialogue: 0,0:02:02.28,0:02:08.46,Default,,0000,0000,0000,,both the lecture notes and recordings of Dialogue: 0,0:02:05.31,0:02:10.11,Default,,0000,0000,0000,,the lectures online exactly when we do Dialogue: 0,0:02:08.46,0:02:12.33,Default,,0000,0000,0000,,that we haven't established yet but it Dialogue: 0,0:02:10.11,0:02:14.28,Default,,0000,0000,0000,,will be after the lectures obviously the Dialogue: 0,0:02:12.33,0:02:16.62,Default,,0000,0000,0000,,videos have to be posted after Dialogue: 0,0:02:14.28,0:02:19.38,Default,,0000,0000,0000,,the class is gonna be run by me John and Dialogue: 0,0:02:16.62,0:02:21.12,Default,,0000,0000,0000,,Anne each sitting over there and Jose Dialogue: 0,0:02:19.38,0:02:24.09,Default,,0000,0000,0000,,who is not currently here but we'll be Dialogue: 0,0:02:21.12,0:02:25.74,Default,,0000,0000,0000,,holding tomorrow's lecture and keep in Dialogue: 0,0:02:24.09,0:02:27.99,Default,,0000,0000,0000,,mind that we're trying to cover a lot of Dialogue: 0,0:02:25.74,0:02:30.72,Default,,0000,0000,0000,,ground over the course of just 11 Dialogue: 0,0:02:27.99,0:02:33.24,Default,,0000,0000,0000,,one-hour lectures and so we will be Dialogue: 0,0:02:30.72,0:02:35.46,Default,,0000,0000,0000,,moving relatively rapidly but please do Dialogue: 0,0:02:33.24,0:02:37.08,Default,,0000,0000,0000,,stop us if there's anything where you Dialogue: 0,0:02:35.46,0:02:38.43,Default,,0000,0000,0000,,feel like you're not following along if Dialogue: 0,0:02:37.08,0:02:40.29,Default,,0000,0000,0000,,you feel like there's something you wish Dialogue: 0,0:02:38.43,0:02:41.73,Default,,0000,0000,0000,,we would spend more time on just let us Dialogue: 0,0:02:40.29,0:02:45.24,Default,,0000,0000,0000,,know please interrupt us with questions Dialogue: 0,0:02:41.73,0:02:47.22,Default,,0000,0000,0000,,and also after each lecture we're going Dialogue: 0,0:02:45.24,0:02:49.65,Default,,0000,0000,0000,,to hold office hours on the ninth floor Dialogue: 0,0:02:47.22,0:02:51.57,Default,,0000,0000,0000,,of building 30 to the Stata Center of Dialogue: 0,0:02:49.65,0:02:53.22,Default,,0000,0000,0000,,the computer science building as if you Dialogue: 0,0:02:51.57,0:02:55.98,Default,,0000,0000,0000,,show up up in the ninth floor lounge Dialogue: 0,0:02:53.22,0:02:58.14,Default,,0000,0000,0000,,there and the gates tower then you can Dialogue: 0,0:02:55.98,0:03:00.75,Default,,0000,0000,0000,,come and try some of the exercises that Dialogue: 0,0:02:58.14,0:03:02.94,Default,,0000,0000,0000,,we give for each lecture or just ask us Dialogue: 0,0:03:00.75,0:03:04.44,Default,,0000,0000,0000,,other questions about things we've Dialogue: 0,0:03:02.94,0:03:08.00,Default,,0000,0000,0000,,talked about in lecturer or other things Dialogue: 0,0:03:04.44,0:03:08.00,Default,,0000,0000,0000,,about using your computer efficiently Dialogue: 0,0:03:08.15,0:03:13.74,Default,,0000,0000,0000,,due to the limited time that we have Dialogue: 0,0:03:11.64,0:03:16.53,Default,,0000,0000,0000,,available we're not going to be able to Dialogue: 0,0:03:13.74,0:03:19.08,Default,,0000,0000,0000,,cover all tools and full detail and so Dialogue: 0,0:03:16.53,0:03:21.24,Default,,0000,0000,0000,,we'll try to do is highlight interesting Dialogue: 0,0:03:19.08,0:03:23.43,Default,,0000,0000,0000,,tools and interesting ways to use them Dialogue: 0,0:03:21.24,0:03:25.11,Default,,0000,0000,0000,,we won't necessarily dig into the deep Dialogue: 0,0:03:23.43,0:03:27.54,Default,,0000,0000,0000,,details about how all of it works or Dialogue: 0,0:03:25.11,0:03:29.07,Default,,0000,0000,0000,,more elaborate use cases but if you have Dialogue: 0,0:03:27.54,0:03:31.05,Default,,0000,0000,0000,,questions about them please come ask us Dialogue: 0,0:03:29.07,0:03:33.69,Default,,0000,0000,0000,,about that too many of these tools are Dialogue: 0,0:03:31.05,0:03:34.86,Default,,0000,0000,0000,,tools that we have used for years and we Dialogue: 0,0:03:33.69,0:03:36.68,Default,,0000,0000,0000,,might be able to point you to additional Dialogue: 0,0:03:34.86,0:03:39.06,Default,,0000,0000,0000,,interesting things you can do with them Dialogue: 0,0:03:36.68,0:03:42.99,Default,,0000,0000,0000,,sort of like take advantage of the fact Dialogue: 0,0:03:39.06,0:03:45.21,Default,,0000,0000,0000,,that we're here this class is going to I Dialogue: 0,0:03:42.99,0:03:46.98,Default,,0000,0000,0000,,don't wanna say ramped up quickly but Dialogue: 0,0:03:45.21,0:03:49.05,Default,,0000,0000,0000,,what's going to happen over the course Dialogue: 0,0:03:46.98,0:03:51.33,Default,,0000,0000,0000,,of this particular lecture is that we'll Dialogue: 0,0:03:49.05,0:03:52.53,Default,,0000,0000,0000,,cover many of the basics that we assume Dialogue: 0,0:03:51.33,0:03:54.48,Default,,0000,0000,0000,,that you will know for the rest of the Dialogue: 0,0:03:52.53,0:03:56.01,Default,,0000,0000,0000,,semester things like how to use your Dialogue: 0,0:03:54.48,0:03:57.21,Default,,0000,0000,0000,,shell and your terminal and I'll explain Dialogue: 0,0:03:56.01,0:03:59.85,Default,,0000,0000,0000,,what those are - those who you're not Dialogue: 0,0:03:57.21,0:04:01.89,Default,,0000,0000,0000,,familiar with them and then will pretty Dialogue: 0,0:03:59.85,0:04:03.84,Default,,0000,0000,0000,,quickly ramp up into more advanced tools Dialogue: 0,0:04:01.89,0:04:05.25,Default,,0000,0000,0000,,and how to use them you can already see Dialogue: 0,0:04:03.84,0:04:07.49,Default,,0000,0000,0000,,from the lecture notes the kind of Dialogue: 0,0:04:05.25,0:04:10.11,Default,,0000,0000,0000,,topics that we're going to be covering Dialogue: 0,0:04:07.49,0:04:12.12,Default,,0000,0000,0000,,and so that brings us to today's lecture Dialogue: 0,0:04:10.11,0:04:14.64,Default,,0000,0000,0000,,in which we are going to cover the shell Dialogue: 0,0:04:12.12,0:04:16.95,Default,,0000,0000,0000,,and the shell is going to be one of the Dialogue: 0,0:04:14.64,0:04:19.29,Default,,0000,0000,0000,,primary ways that you interact with your Dialogue: 0,0:04:16.95,0:04:21.30,Default,,0000,0000,0000,,computer once you want to do more things Dialogue: 0,0:04:19.29,0:04:24.54,Default,,0000,0000,0000,,than what the sort of visual interfaces Dialogue: 0,0:04:21.30,0:04:26.37,Default,,0000,0000,0000,,you might be used to allow you to do the Dialogue: 0,0:04:24.54,0:04:26.55,Default,,0000,0000,0000,,visual interfaces are sort of limited in Dialogue: 0,0:04:26.37,0:04:28.56,Default,,0000,0000,0000,,what Dialogue: 0,0:04:26.55,0:04:29.67,Default,,0000,0000,0000,,they allow you to do because you can Dialogue: 0,0:04:28.56,0:04:32.01,Default,,0000,0000,0000,,only do the things that there are Dialogue: 0,0:04:29.67,0:04:34.92,Default,,0000,0000,0000,,buttons for sliders for input fields for Dialogue: 0,0:04:32.01,0:04:37.47,Default,,0000,0000,0000,,often these textual tools are built to Dialogue: 0,0:04:34.92,0:04:39.90,Default,,0000,0000,0000,,be both composable with one another but Dialogue: 0,0:04:37.47,0:04:41.43,Default,,0000,0000,0000,,also to have tons of different ways to Dialogue: 0,0:04:39.90,0:04:42.96,Default,,0000,0000,0000,,combine them or ways to program and Dialogue: 0,0:04:41.43,0:04:44.94,Default,,0000,0000,0000,,automate them and that is why in this Dialogue: 0,0:04:42.96,0:04:48.06,Default,,0000,0000,0000,,class we will be focusing on these Dialogue: 0,0:04:44.94,0:04:49.86,Default,,0000,0000,0000,,command line or text-based tools and the Dialogue: 0,0:04:48.06,0:04:51.87,Default,,0000,0000,0000,,shell is the place that you would do Dialogue: 0,0:04:49.86,0:04:53.85,Default,,0000,0000,0000,,most of this work so for those of you Dialogue: 0,0:04:51.87,0:04:56.73,Default,,0000,0000,0000,,are not familiar with the shell most Dialogue: 0,0:04:53.85,0:04:59.22,Default,,0000,0000,0000,,platform provides some kind of shell on Dialogue: 0,0:04:56.73,0:05:00.78,Default,,0000,0000,0000,,Windows this is often PowerShell but Dialogue: 0,0:04:59.22,0:05:04.14,Default,,0000,0000,0000,,there are also other shells available on Dialogue: 0,0:05:00.78,0:05:06.39,Default,,0000,0000,0000,,Windows on Linux you will find tons of Dialogue: 0,0:05:04.14,0:05:08.22,Default,,0000,0000,0000,,terminals these are windows that allow Dialogue: 0,0:05:06.39,0:05:10.50,Default,,0000,0000,0000,,you to display shells and you'll also Dialogue: 0,0:05:08.22,0:05:13.23,Default,,0000,0000,0000,,find many different types of shells the Dialogue: 0,0:05:10.50,0:05:15.81,Default,,0000,0000,0000,,most common of which is bash or the born Dialogue: 0,0:05:13.23,0:05:17.46,Default,,0000,0000,0000,,again shell because it's such a common Dialogue: 0,0:05:15.81,0:05:18.99,Default,,0000,0000,0000,,shell it is the one we're primarily Dialogue: 0,0:05:17.46,0:05:21.30,Default,,0000,0000,0000,,going to be covering in these lectures Dialogue: 0,0:05:18.99,0:05:23.58,Default,,0000,0000,0000,,if you're on Mac OS you will probably Dialogue: 0,0:05:21.30,0:05:26.16,Default,,0000,0000,0000,,also have bash maybe an older version of Dialogue: 0,0:05:23.58,0:05:27.48,Default,,0000,0000,0000,,it if you open the terminal app and so Dialogue: 0,0:05:26.16,0:05:29.19,Default,,0000,0000,0000,,if you want to follow along on any of Dialogue: 0,0:05:27.48,0:05:30.21,Default,,0000,0000,0000,,these platforms feel free but keep in Dialogue: 0,0:05:29.19,0:05:32.52,Default,,0000,0000,0000,,mind that most of this is going to be Dialogue: 0,0:05:30.21,0:05:34.23,Default,,0000,0000,0000,,sort of Linux centric in terms of how we Dialogue: 0,0:05:32.52,0:05:39.00,Default,,0000,0000,0000,,teach it even though most of these tools Dialogue: 0,0:05:34.23,0:05:40.41,Default,,0000,0000,0000,,work on all the platforms if you want to Dialogue: 0,0:05:39.00,0:05:42.54,Default,,0000,0000,0000,,install a terminal and a shell and you Dialogue: 0,0:05:40.41,0:05:45.33,Default,,0000,0000,0000,,don't know how to do it well we're happy Dialogue: 0,0:05:42.54,0:05:47.40,Default,,0000,0000,0000,,to show you at office hours or it's Dialogue: 0,0:05:45.33,0:05:51.60,Default,,0000,0000,0000,,usually very easy to just Google like Dialogue: 0,0:05:47.40,0:05:57.06,Default,,0000,0000,0000,,your platform plus like terminal and you Dialogue: 0,0:05:51.60,0:05:59.04,Default,,0000,0000,0000,,will get one now when you open a Dialogue: 0,0:05:57.06,0:06:01.17,Default,,0000,0000,0000,,terminal you get something that looks a Dialogue: 0,0:05:59.04,0:06:04.23,Default,,0000,0000,0000,,little bit like this so it will usually Dialogue: 0,0:06:01.17,0:06:06.00,Default,,0000,0000,0000,,have just a single line at the top and Dialogue: 0,0:06:04.23,0:06:07.71,Default,,0000,0000,0000,,this is what's known as the shell prompt Dialogue: 0,0:06:06.00,0:06:10.02,Default,,0000,0000,0000,,you can see that my shell prompt looks Dialogue: 0,0:06:07.71,0:06:12.09,Default,,0000,0000,0000,,like this it has my user name the name Dialogue: 0,0:06:10.02,0:06:14.22,Default,,0000,0000,0000,,of the machine that I'm on the current Dialogue: 0,0:06:12.09,0:06:16.77,Default,,0000,0000,0000,,path I'm on and we will talk about paths Dialogue: 0,0:06:14.22,0:06:18.72,Default,,0000,0000,0000,,a little bit later and then it's really Dialogue: 0,0:06:16.77,0:06:20.97,Default,,0000,0000,0000,,just sort of blinking they're asking me Dialogue: 0,0:06:18.72,0:06:22.44,Default,,0000,0000,0000,,for input and this is the shell prompt Dialogue: 0,0:06:20.97,0:06:25.86,Default,,0000,0000,0000,,where you tell the shell what you want Dialogue: 0,0:06:22.44,0:06:27.48,Default,,0000,0000,0000,,it to do and you can customize this Dialogue: 0,0:06:25.86,0:06:28.62,Default,,0000,0000,0000,,prompt a lot and when you open it on Dialogue: 0,0:06:27.48,0:06:31.14,Default,,0000,0000,0000,,your machine it might not look exactly Dialogue: 0,0:06:28.62,0:06:33.84,Default,,0000,0000,0000,,like this it might look something like Dialogue: 0,0:06:31.14,0:06:35.40,Default,,0000,0000,0000,,this if you've configured it a little or Dialogue: 0,0:06:33.84,0:06:38.28,Default,,0000,0000,0000,,it might look all sorts of different Dialogue: 0,0:06:35.40,0:06:39.78,Default,,0000,0000,0000,,ways we won't go too much into Dialogue: 0,0:06:38.28,0:06:40.35,Default,,0000,0000,0000,,customizing your shell in this Dialogue: 0,0:06:39.78,0:06:41.91,Default,,0000,0000,0000,,particularly Dialogue: 0,0:06:40.35,0:06:43.71,Default,,0000,0000,0000,,we'll do that later here we're just Dialogue: 0,0:06:41.91,0:06:47.79,Default,,0000,0000,0000,,going to talk about how do you use this Dialogue: 0,0:06:43.71,0:06:49.86,Default,,0000,0000,0000,,shell to do useful things and this is Dialogue: 0,0:06:47.79,0:06:51.75,Default,,0000,0000,0000,,our the main textual interface you have Dialogue: 0,0:06:49.86,0:06:53.43,Default,,0000,0000,0000,,to your computer's through this shell on Dialogue: 0,0:06:51.75,0:06:55.95,Default,,0000,0000,0000,,the shell prompt you get to write Dialogue: 0,0:06:53.43,0:06:58.92,Default,,0000,0000,0000,,commands and commands can be relatively Dialogue: 0,0:06:55.95,0:07:00.57,Default,,0000,0000,0000,,straightforward things usually it'll be Dialogue: 0,0:06:58.92,0:07:02.55,Default,,0000,0000,0000,,something like executing programs with Dialogue: 0,0:07:00.57,0:07:04.47,Default,,0000,0000,0000,,arguments what does that look like well Dialogue: 0,0:07:02.55,0:07:06.21,Default,,0000,0000,0000,,one program we can execute is the date Dialogue: 0,0:07:04.47,0:07:07.38,Default,,0000,0000,0000,,program we just type date and press Dialogue: 0,0:07:06.21,0:07:10.29,Default,,0000,0000,0000,,enter and then it will show you Dialogue: 0,0:07:07.38,0:07:12.33,Default,,0000,0000,0000,,unsurprisingly the date and time you can Dialogue: 0,0:07:10.29,0:07:14.85,Default,,0000,0000,0000,,also execute a program with arguments Dialogue: 0,0:07:12.33,0:07:17.79,Default,,0000,0000,0000,,this is one way to modify the behavior Dialogue: 0,0:07:14.85,0:07:20.76,Default,,0000,0000,0000,,of the program so for example there is a Dialogue: 0,0:07:17.79,0:07:22.41,Default,,0000,0000,0000,,program called echo and echo just prints Dialogue: 0,0:07:20.76,0:07:25.05,Default,,0000,0000,0000,,out the arguments that you give it and Dialogue: 0,0:07:22.41,0:07:27.33,Default,,0000,0000,0000,,arguments are just white space separated Dialogue: 0,0:07:25.05,0:07:29.82,Default,,0000,0000,0000,,things that follow the program name so Dialogue: 0,0:07:27.33,0:07:30.72,Default,,0000,0000,0000,,we can say hello and then it will print Dialogue: 0,0:07:29.82,0:07:32.94,Default,,0000,0000,0000,,hello back Dialogue: 0,0:07:30.72,0:07:35.61,Default,,0000,0000,0000,,perhaps not terribly surprising but this Dialogue: 0,0:07:32.94,0:07:37.05,Default,,0000,0000,0000,,is the very basics of arguments one Dialogue: 0,0:07:35.61,0:07:38.55,Default,,0000,0000,0000,,thing that you'll notice is that I said Dialogue: 0,0:07:37.05,0:07:40.38,Default,,0000,0000,0000,,that arguments are separated by Dialogue: 0,0:07:38.55,0:07:42.06,Default,,0000,0000,0000,,whitespace and you might wonder well Dialogue: 0,0:07:40.38,0:07:44.31,Default,,0000,0000,0000,,what if I want an argument as multiple Dialogue: 0,0:07:42.06,0:07:47.22,Default,,0000,0000,0000,,words you can also quote things so you Dialogue: 0,0:07:44.31,0:07:50.31,Default,,0000,0000,0000,,can do things like echo hello space Dialogue: 0,0:07:47.22,0:07:52.71,Default,,0000,0000,0000,,world and now the echo program receives Dialogue: 0,0:07:50.31,0:07:55.38,Default,,0000,0000,0000,,one argument that contains the string Dialogue: 0,0:07:52.71,0:07:57.54,Default,,0000,0000,0000,,hello world with a space well you can Dialogue: 0,0:07:55.38,0:07:58.77,Default,,0000,0000,0000,,also use single quotes for this and the Dialogue: 0,0:07:57.54,0:08:00.48,Default,,0000,0000,0000,,difference between single quotes and Dialogue: 0,0:07:58.77,0:08:03.42,Default,,0000,0000,0000,,double quotes will get back to and when Dialogue: 0,0:08:00.48,0:08:06.12,Default,,0000,0000,0000,,we talk about bash scripting you can Dialogue: 0,0:08:03.42,0:08:09.00,Default,,0000,0000,0000,,also just escape single characters so Dialogue: 0,0:08:06.12,0:08:12.15,Default,,0000,0000,0000,,for example hello world this will also Dialogue: 0,0:08:09.00,0:08:15.72,Default,,0000,0000,0000,,work just fine all of these rules about Dialogue: 0,0:08:12.15,0:08:17.34,Default,,0000,0000,0000,,how you escape and how you parse and Dialogue: 0,0:08:15.72,0:08:19.59,Default,,0000,0000,0000,,quote various arguments and variables Dialogue: 0,0:08:17.34,0:08:21.33,Default,,0000,0000,0000,,we'll cover a little bit later hopefully Dialogue: 0,0:08:19.59,0:08:23.52,Default,,0000,0000,0000,,you won't run into too many we oughta Dialogue: 0,0:08:21.33,0:08:26.07,Default,,0000,0000,0000,,tease about this just keep in mind at Dialogue: 0,0:08:23.52,0:08:27.93,Default,,0000,0000,0000,,least that spaces separate arguments so Dialogue: 0,0:08:26.07,0:08:29.61,Default,,0000,0000,0000,,if you want to do something like make a Dialogue: 0,0:08:27.93,0:08:31.92,Default,,0000,0000,0000,,directory called my photos Dialogue: 0,0:08:29.61,0:08:33.78,Default,,0000,0000,0000,,you can't just type like make directory Dialogue: 0,0:08:31.92,0:08:35.88,Default,,0000,0000,0000,,my photos it will create two directories Dialogue: 0,0:08:33.78,0:08:40.01,Default,,0000,0000,0000,,one called my and one called photos and Dialogue: 0,0:08:35.88,0:08:43.23,Default,,0000,0000,0000,,that is probably not what you want now Dialogue: 0,0:08:40.01,0:08:45.60,Default,,0000,0000,0000,,one thing you might ask is how does the Dialogue: 0,0:08:43.23,0:08:48.84,Default,,0000,0000,0000,,shell know what these programs are when Dialogue: 0,0:08:45.60,0:08:50.70,Default,,0000,0000,0000,,I type date or when I type echo how does Dialogue: 0,0:08:48.84,0:08:53.19,Default,,0000,0000,0000,,it know what these programs are supposed Dialogue: 0,0:08:50.70,0:08:54.00,Default,,0000,0000,0000,,to do and the answer to this is your Dialogue: 0,0:08:53.19,0:08:55.44,Default,,0000,0000,0000,,program your Dialogue: 0,0:08:54.00,0:08:57.00,Default,,0000,0000,0000,,computer has a bunch of built-in Dialogue: 0,0:08:55.44,0:08:59.76,Default,,0000,0000,0000,,programs that comes with the machine Dialogue: 0,0:08:57.00,0:09:02.58,Default,,0000,0000,0000,,just like you your machine my chip with Dialogue: 0,0:08:59.76,0:09:05.34,Default,,0000,0000,0000,,like the terminal app or it might chip Dialogue: 0,0:09:02.58,0:09:07.80,Default,,0000,0000,0000,,with like Windows Explorer or at my chip Dialogue: 0,0:09:05.34,0:09:09.57,Default,,0000,0000,0000,,with some kind of browser it also ships Dialogue: 0,0:09:07.80,0:09:11.64,Default,,0000,0000,0000,,with a bunch of terminal centric Dialogue: 0,0:09:09.57,0:09:14.82,Default,,0000,0000,0000,,applications and these are stored on Dialogue: 0,0:09:11.64,0:09:18.21,Default,,0000,0000,0000,,your file system and your shell has a Dialogue: 0,0:09:14.82,0:09:19.95,Default,,0000,0000,0000,,way to determine where a program is Dialogue: 0,0:09:18.21,0:09:22.46,Default,,0000,0000,0000,,located basically has a way to search Dialogue: 0,0:09:19.95,0:09:24.62,Default,,0000,0000,0000,,for programs it does this through Dialogue: 0,0:09:22.46,0:09:27.39,Default,,0000,0000,0000,,something called an invariant Dialogue: 0,0:09:24.62,0:09:29.97,Default,,0000,0000,0000,,environment variable an environment Dialogue: 0,0:09:27.39,0:09:31.56,Default,,0000,0000,0000,,variable is a variable like you might be Dialogue: 0,0:09:29.97,0:09:33.90,Default,,0000,0000,0000,,used to for programming languages it Dialogue: 0,0:09:31.56,0:09:35.16,Default,,0000,0000,0000,,turns out that the shell and the Dialogue: 0,0:09:33.90,0:09:37.35,Default,,0000,0000,0000,,bourne-again shell in particular is Dialogue: 0,0:09:35.16,0:09:39.42,Default,,0000,0000,0000,,really a programming language this Dialogue: 0,0:09:37.35,0:09:41.55,Default,,0000,0000,0000,,prompt that you're given here is not Dialogue: 0,0:09:39.42,0:09:43.47,Default,,0000,0000,0000,,just able to run a program with Dialogue: 0,0:09:41.55,0:09:46.47,Default,,0000,0000,0000,,arguments. You can also do things like Dialogue: 0,0:09:43.47,0:09:47.91,Default,,0000,0000,0000,,while loops, for loops, conditionals... Dialogue: 0,0:09:46.47,0:09:49.86,Default,,0000,0000,0000,,All of these - you can define Dialogue: 0,0:09:47.91,0:09:51.00,Default,,0000,0000,0000,,functions, you can have variables, and all Dialogue: 0,0:09:49.86,0:09:52.86,Default,,0000,0000,0000,,of these things you can do in the shell. Dialogue: 0,0:09:51.00,0:09:56.40,Default,,0000,0000,0000,,We'll cover a lot of that in the next Dialogue: 0,0:09:52.86,0:09:57.99,Default,,0000,0000,0000,,lecture, on shell scripting. For now, Dialogue: 0,0:09:56.40,0:09:59.79,Default,,0000,0000,0000,,though, let's just look at this Dialogue: 0,0:09:57.99,0:10:01.20,Default,,0000,0000,0000,,particular environment variable. Dialogue: 0,0:09:59.79,0:10:02.70,Default,,0000,0000,0000,,Environment variables are things that Dialogue: 0,0:10:01.20,0:10:04.83,Default,,0000,0000,0000,,are set whenever you start your shell Dialogue: 0,0:10:02.70,0:10:06.60,Default,,0000,0000,0000,,they're not things you have to set every Dialogue: 0,0:10:04.83,0:10:08.16,Default,,0000,0000,0000,,time you run your shell there are a Dialogue: 0,0:10:06.60,0:10:09.75,Default,,0000,0000,0000,,bunch of these that are set things like Dialogue: 0,0:10:08.16,0:10:11.85,Default,,0000,0000,0000,,where is your home directory what is Dialogue: 0,0:10:09.75,0:10:13.08,Default,,0000,0000,0000,,your username and there's also one Dialogue: 0,0:10:11.85,0:10:16.17,Default,,0000,0000,0000,,that's critical for this particular Dialogue: 0,0:10:13.08,0:10:18.93,Default,,0000,0000,0000,,purpose which is the path variable so if Dialogue: 0,0:10:16.17,0:10:22.59,Default,,0000,0000,0000,,I echo out dollar path this is going to Dialogue: 0,0:10:18.93,0:10:25.10,Default,,0000,0000,0000,,show me all of the paths on my machine Dialogue: 0,0:10:22.59,0:10:27.93,Default,,0000,0000,0000,,that the shell will search for programs Dialogue: 0,0:10:25.10,0:10:30.87,Default,,0000,0000,0000,,you'll notice that this is a list that Dialogue: 0,0:10:27.93,0:10:33.00,Default,,0000,0000,0000,,is colon separated it might be kind of Dialogue: 0,0:10:30.87,0:10:36.00,Default,,0000,0000,0000,,long and hard to read but the essentials Dialogue: 0,0:10:33.00,0:10:38.28,Default,,0000,0000,0000,,is that - whenever you type the name of Dialogue: 0,0:10:36.00,0:10:41.61,Default,,0000,0000,0000,,a program is gonna search through this Dialogue: 0,0:10:38.28,0:10:43.77,Default,,0000,0000,0000,,list of paths on your machine and it's Dialogue: 0,0:10:41.61,0:10:46.92,Default,,0000,0000,0000,,gonna look in each directory for a Dialogue: 0,0:10:43.77,0:10:49.11,Default,,0000,0000,0000,,program or a file whose name matches the Dialogue: 0,0:10:46.92,0:10:51.03,Default,,0000,0000,0000,,command you try to run so in my case Dialogue: 0,0:10:49.11,0:10:52.80,Default,,0000,0000,0000,,when I try to run date or echo it's Dialogue: 0,0:10:51.03,0:10:54.51,Default,,0000,0000,0000,,gonna walk through these one at a time Dialogue: 0,0:10:52.80,0:10:56.37,Default,,0000,0000,0000,,until it finds one that contains the Dialogue: 0,0:10:54.51,0:10:58.41,Default,,0000,0000,0000,,program called date or echo and then Dialogue: 0,0:10:56.37,0:11:00.00,Default,,0000,0000,0000,,it's gonna run it if we want to know Dialogue: 0,0:10:58.41,0:11:01.65,Default,,0000,0000,0000,,which one it actually runs there's a Dialogue: 0,0:11:00.00,0:11:04.62,Default,,0000,0000,0000,,command called which which lets us do Dialogue: 0,0:11:01.65,0:11:07.50,Default,,0000,0000,0000,,that so I can type which echo and will Dialogue: 0,0:11:04.62,0:11:10.83,Default,,0000,0000,0000,,tell me that if I were to run a program Dialogue: 0,0:11:07.50,0:11:12.72,Default,,0000,0000,0000,,called echo I would run this one it's Dialogue: 0,0:11:10.83,0:11:16.35,Default,,0000,0000,0000,,worth pausing here to talk about what Dialogue: 0,0:11:12.72,0:11:18.62,Default,,0000,0000,0000,,paths are so paths are a way to name the Dialogue: 0,0:11:16.35,0:11:21.63,Default,,0000,0000,0000,,location of a file on your computer on Dialogue: 0,0:11:18.62,0:11:24.78,Default,,0000,0000,0000,,Linux and Oh Mac OS these paths are Dialogue: 0,0:11:21.63,0:11:28.17,Default,,0000,0000,0000,,separated by slashes forward slashes so Dialogue: 0,0:11:24.78,0:11:30.93,Default,,0000,0000,0000,,you'll see here that this is in the in Dialogue: 0,0:11:28.17,0:11:32.76,Default,,0000,0000,0000,,the root directory so the slash at the Dialogue: 0,0:11:30.93,0:11:34.85,Default,,0000,0000,0000,,very beginning indicates that this is Dialogue: 0,0:11:32.76,0:11:37.71,Default,,0000,0000,0000,,starting from the top of the file system Dialogue: 0,0:11:34.85,0:11:40.98,Default,,0000,0000,0000,,then look inside the directory called Dialogue: 0,0:11:37.71,0:11:43.58,Default,,0000,0000,0000,,USR then look inside the directory bin Dialogue: 0,0:11:40.98,0:11:46.44,Default,,0000,0000,0000,,and then look for the file called echo Dialogue: 0,0:11:43.58,0:11:48.62,Default,,0000,0000,0000,,on windows paths like this are usually Dialogue: 0,0:11:46.44,0:11:51.90,Default,,0000,0000,0000,,separated by back slashes instead and Dialogue: 0,0:11:48.62,0:11:53.64,Default,,0000,0000,0000,,we're on Linux and Mac OS everything Dialogue: 0,0:11:51.90,0:11:56.37,Default,,0000,0000,0000,,lives under the root name space so all Dialogue: 0,0:11:53.64,0:12:00.27,Default,,0000,0000,0000,,paths start with a slash or all absolute Dialogue: 0,0:11:56.37,0:12:02.07,Default,,0000,0000,0000,,paths on Windows there is one root for Dialogue: 0,0:12:00.27,0:12:05.13,Default,,0000,0000,0000,,every partition so you might have seen Dialogue: 0,0:12:02.07,0:12:08.22,Default,,0000,0000,0000,,things like C colon backslash or D colon Dialogue: 0,0:12:05.13,0:12:11.34,Default,,0000,0000,0000,,backslash so Windows has separate sort Dialogue: 0,0:12:08.22,0:12:13.05,Default,,0000,0000,0000,,of file system path hierarchies for each Dialogue: 0,0:12:11.34,0:12:14.85,Default,,0000,0000,0000,,each Drive that you have Dialogue: 0,0:12:13.05,0:12:18.54,Default,,0000,0000,0000,,whereas on Linux and Mac OS these are Dialogue: 0,0:12:14.85,0:12:20.01,Default,,0000,0000,0000,,all mounted under one namespace you'll Dialogue: 0,0:12:18.54,0:12:21.69,Default,,0000,0000,0000,,notice that I said the word absolute Dialogue: 0,0:12:20.01,0:12:27.36,Default,,0000,0000,0000,,path and you might not know what that Dialogue: 0,0:12:21.69,0:12:29.46,Default,,0000,0000,0000,,means so absolute paths are paths that Dialogue: 0,0:12:27.36,0:12:31.89,Default,,0000,0000,0000,,fully determine the location of a file Dialogue: 0,0:12:29.46,0:12:33.72,Default,,0000,0000,0000,,so in this case this is saying this is Dialogue: 0,0:12:31.89,0:12:36.54,Default,,0000,0000,0000,,talking only about a specific echo file Dialogue: 0,0:12:33.72,0:12:39.03,Default,,0000,0000,0000,,and it's giving you the the full path to Dialogue: 0,0:12:36.54,0:12:42.84,Default,,0000,0000,0000,,that file but there are also things Dialogue: 0,0:12:39.03,0:12:45.24,Default,,0000,0000,0000,,known as relative paths so a relative Dialogue: 0,0:12:42.84,0:12:49.32,Default,,0000,0000,0000,,path is relative to where you currently Dialogue: 0,0:12:45.24,0:12:52.49,Default,,0000,0000,0000,,are and so the way we find out where we Dialogue: 0,0:12:49.32,0:12:56.19,Default,,0000,0000,0000,,currently are is you can type PWD for Dialogue: 0,0:12:52.49,0:13:00.06,Default,,0000,0000,0000,,present working directory present print Dialogue: 0,0:12:56.19,0:13:02.70,Default,,0000,0000,0000,,working directory so if I type PWD it Dialogue: 0,0:13:00.06,0:13:05.79,Default,,0000,0000,0000,,will print out the current path that I'm Dialogue: 0,0:13:02.70,0:13:08.22,Default,,0000,0000,0000,,in right so currently I'm in the home Dialogue: 0,0:13:05.79,0:13:11.03,Default,,0000,0000,0000,,directory under the root and then John Dialogue: 0,0:13:08.22,0:13:14.73,Default,,0000,0000,0000,,under that and then dev under that etc Dialogue: 0,0:13:11.03,0:13:16.77,Default,,0000,0000,0000,,from here I can then choose to change my Dialogue: 0,0:13:14.73,0:13:18.54,Default,,0000,0000,0000,,current working directory and all Dialogue: 0,0:13:16.77,0:13:20.19,Default,,0000,0000,0000,,relative paths are relative to the Dialogue: 0,0:13:18.54,0:13:21.33,Default,,0000,0000,0000,,current working directory which is Dialogue: 0,0:13:20.19,0:13:24.63,Default,,0000,0000,0000,,basically where you Dialogue: 0,0:13:21.33,0:13:28.71,Default,,0000,0000,0000,,they are in this case for example I can Dialogue: 0,0:13:24.63,0:13:30.45,Default,,0000,0000,0000,,do CD / home CDs change directory this Dialogue: 0,0:13:28.71,0:13:32.61,Default,,0000,0000,0000,,is the way that I change what my current Dialogue: 0,0:13:30.45,0:13:34.83,Default,,0000,0000,0000,,working directory is in this case I Dialogue: 0,0:13:32.61,0:13:37.89,Default,,0000,0000,0000,,change to home and I am now you'll see Dialogue: 0,0:13:34.83,0:13:40.62,Default,,0000,0000,0000,,my my shell prompt change to say that I Dialogue: 0,0:13:37.89,0:13:42.66,Default,,0000,0000,0000,,am now in home it just gives me the name Dialogue: 0,0:13:40.62,0:13:44.22,Default,,0000,0000,0000,,of the last segment of the path but you Dialogue: 0,0:13:42.66,0:13:45.51,Default,,0000,0000,0000,,can also configure your terminal to give Dialogue: 0,0:13:44.22,0:13:50.31,Default,,0000,0000,0000,,you the full path whenever you're Dialogue: 0,0:13:45.51,0:13:53.10,Default,,0000,0000,0000,,anywhere and now if I type PWD again it Dialogue: 0,0:13:50.31,0:13:54.87,Default,,0000,0000,0000,,will tell me I'm in slash home there are Dialogue: 0,0:13:53.10,0:13:59.10,Default,,0000,0000,0000,,also a couple of special directories Dialogue: 0,0:13:54.87,0:14:03.15,Default,,0000,0000,0000,,that exist there is dot and dot dot dot Dialogue: 0,0:13:59.10,0:14:05.13,Default,,0000,0000,0000,,means the current directory dot dot Dialogue: 0,0:14:03.15,0:14:06.75,Default,,0000,0000,0000,,means the parent directory so this is a Dialogue: 0,0:14:05.13,0:14:09.54,Default,,0000,0000,0000,,way that you can easily navigate around Dialogue: 0,0:14:06.75,0:14:13.08,Default,,0000,0000,0000,,the system for example here if I type CD Dialogue: 0,0:14:09.54,0:14:15.18,Default,,0000,0000,0000,,dot dot it will tell me that I am now in Dialogue: 0,0:14:13.08,0:14:17.64,Default,,0000,0000,0000,,slash so I'm now in the root of the file Dialogue: 0,0:14:15.18,0:14:22.14,Default,,0000,0000,0000,,system I was in slash home now I'm in Dialogue: 0,0:14:17.64,0:14:24.87,Default,,0000,0000,0000,,slash and indeed if I type PWD well it Dialogue: 0,0:14:22.14,0:14:26.79,Default,,0000,0000,0000,,will do that right thing and I can also Dialogue: 0,0:14:24.87,0:14:28.98,Default,,0000,0000,0000,,then use relative paths to go down into Dialogue: 0,0:14:26.79,0:14:31.77,Default,,0000,0000,0000,,the file system right so I can do CD dot Dialogue: 0,0:14:28.98,0:14:34.08,Default,,0000,0000,0000,,slash home and this is gonna CD into the Dialogue: 0,0:14:31.77,0:14:36.90,Default,,0000,0000,0000,,home directory under the current Dialogue: 0,0:14:34.08,0:14:39.84,Default,,0000,0000,0000,,directory right so this will bring me Dialogue: 0,0:14:36.90,0:14:42.12,Default,,0000,0000,0000,,back to slash home if I now tried CD dot Dialogue: 0,0:14:39.84,0:14:44.10,Default,,0000,0000,0000,,slash home again it will say there's no Dialogue: 0,0:14:42.12,0:14:45.57,Default,,0000,0000,0000,,such directory because there is no home Dialogue: 0,0:14:44.10,0:14:49.43,Default,,0000,0000,0000,,directory under the current directory Dialogue: 0,0:14:45.57,0:14:53.70,Default,,0000,0000,0000,,I'm on which I changed by doing CD right Dialogue: 0,0:14:49.43,0:14:57.51,Default,,0000,0000,0000,,and I can sort of see de all the way Dialogue: 0,0:14:53.70,0:15:01.11,Default,,0000,0000,0000,,back to the place that I was using Dialogue: 0,0:14:57.51,0:15:07.04,Default,,0000,0000,0000,,relative paths and I can also do things Dialogue: 0,0:15:01.11,0:15:09.06,Default,,0000,0000,0000,,like dot dot dot dot dot to get back to Dialogue: 0,0:15:07.04,0:15:10.65,Default,,0000,0000,0000,,somewhere deep in my file system this Dialogue: 0,0:15:09.06,0:15:13.02,Default,,0000,0000,0000,,happens to be all the way back to the Dialogue: 0,0:15:10.65,0:15:15.63,Default,,0000,0000,0000,,root so here there's a bin directory and Dialogue: 0,0:15:13.02,0:15:17.85,Default,,0000,0000,0000,,another bin there's an echo file and so Dialogue: 0,0:15:15.63,0:15:20.31,Default,,0000,0000,0000,,then I could do world and that runs the Dialogue: 0,0:15:17.85,0:15:22.08,Default,,0000,0000,0000,,echo program under bin alright so this Dialogue: 0,0:15:20.31,0:15:24.44,Default,,0000,0000,0000,,is a way that you can construct paths to Dialogue: 0,0:15:22.08,0:15:26.58,Default,,0000,0000,0000,,arbitrarily traverse your filesystem Dialogue: 0,0:15:24.44,0:15:28.38,Default,,0000,0000,0000,,sometimes you want to absolute paths and Dialogue: 0,0:15:26.58,0:15:29.79,Default,,0000,0000,0000,,sometimes you want relative ones usually Dialogue: 0,0:15:28.38,0:15:33.18,Default,,0000,0000,0000,,you want to use whichever one is shorter Dialogue: 0,0:15:29.79,0:15:34.39,Default,,0000,0000,0000,,but if you want to for example run a Dialogue: 0,0:15:30.63,0:15:34.39,Default,,0000,0000,0000,,program or write Dialogue: 0,0:15:34.39,0:15:38.98,Default,,0000,0000,0000,,a program that runs the program like Dialogue: 0,0:15:36.94,0:15:41.83,Default,,0000,0000,0000,,echo or date and you want it to be able Dialogue: 0,0:15:38.98,0:15:43.66,Default,,0000,0000,0000,,to run be run from anywhere you either Dialogue: 0,0:15:41.83,0:15:45.64,Default,,0000,0000,0000,,want to just give the name of the Dialogue: 0,0:15:43.66,0:15:47.77,Default,,0000,0000,0000,,program like date or echo and let the the Dialogue: 0,0:15:45.64,0:15:49.72,Default,,0000,0000,0000,,shell use the path to figure out where Dialogue: 0,0:15:47.77,0:15:51.67,Default,,0000,0000,0000,,it is or you want to give its absolute Dialogue: 0,0:15:49.72,0:15:53.50,Default,,0000,0000,0000,,path because if you gave a relative path Dialogue: 0,0:15:51.67,0:15:55.84,Default,,0000,0000,0000,,then if I ran it in my home directory Dialogue: 0,0:15:53.50,0:16:01.72,Default,,0000,0000,0000,,and you ran it in some other directory Dialogue: 0,0:15:55.84,0:16:04.60,Default,,0000,0000,0000,,it might work for me but not for you in Dialogue: 0,0:16:01.72,0:16:06.34,Default,,0000,0000,0000,,general when we run a program it is Dialogue: 0,0:16:04.60,0:16:08.32,Default,,0000,0000,0000,,going to be operating on the current Dialogue: 0,0:16:06.34,0:16:09.91,Default,,0000,0000,0000,,working directory at least by default Dialogue: 0,0:16:08.32,0:16:11.98,Default,,0000,0000,0000,,unless we give it any other arguments Dialogue: 0,0:16:09.91,0:16:13.75,Default,,0000,0000,0000,,and this is really handy because it Dialogue: 0,0:16:11.98,0:16:15.73,Default,,0000,0000,0000,,means that often we don't have to give Dialogue: 0,0:16:13.75,0:16:17.68,Default,,0000,0000,0000,,full paths for things we can just use Dialogue: 0,0:16:15.73,0:16:20.05,Default,,0000,0000,0000,,the name of files and in the directory Dialogue: 0,0:16:17.68,0:16:22.57,Default,,0000,0000,0000,,that we're currently in one thing that's Dialogue: 0,0:16:20.05,0:16:24.28,Default,,0000,0000,0000,,really useful is to figure out what is Dialogue: 0,0:16:22.57,0:16:26.41,Default,,0000,0000,0000,,in the current directory we're in so we Dialogue: 0,0:16:24.28,0:16:28.06,Default,,0000,0000,0000,,already saw PWD which prints where you Dialogue: 0,0:16:26.41,0:16:31.09,Default,,0000,0000,0000,,currently are there's a command called Dialogue: 0,0:16:28.06,0:16:33.31,Default,,0000,0000,0000,,LS which will show you it will list the Dialogue: 0,0:16:31.09,0:16:35.98,Default,,0000,0000,0000,,files in the current directory so if i Dialogue: 0,0:16:33.31,0:16:38.05,Default,,0000,0000,0000,,type LS here this is all the files in Dialogue: 0,0:16:35.98,0:16:39.85,Default,,0000,0000,0000,,the current directory right and this is Dialogue: 0,0:16:38.05,0:16:43.42,Default,,0000,0000,0000,,a handy way to just quickly navigate Dialogue: 0,0:16:39.85,0:16:46.93,Default,,0000,0000,0000,,through the filesystem you'll see that Dialogue: 0,0:16:43.42,0:16:48.49,Default,,0000,0000,0000,,if I sort of CD dot and then do LS it'll Dialogue: 0,0:16:46.93,0:16:53.37,Default,,0000,0000,0000,,show me the files in that directory Dialogue: 0,0:16:48.49,0:16:56.26,Default,,0000,0000,0000,,instead but with LS I can also give it Dialogue: 0,0:16:53.37,0:16:58.36,Default,,0000,0000,0000,,LS dot dot like I can give it a path and Dialogue: 0,0:16:56.26,0:16:59.92,Default,,0000,0000,0000,,then will LS that file instead of the Dialogue: 0,0:16:58.36,0:17:04.27,Default,,0000,0000,0000,,one that I'm currently in or LS that Dialogue: 0,0:16:59.92,0:17:05.83,Default,,0000,0000,0000,,directory and you can see this if I go Dialogue: 0,0:17:04.27,0:17:09.22,Default,,0000,0000,0000,,all the way to the root as well right Dialogue: 0,0:17:05.83,0:17:11.56,Default,,0000,0000,0000,,root has different files one handy trick Dialogue: 0,0:17:09.22,0:17:13.57,Default,,0000,0000,0000,,you might not know about here is there Dialogue: 0,0:17:11.56,0:17:16.57,Default,,0000,0000,0000,,are two other special things you can do Dialogue: 0,0:17:13.57,0:17:18.34,Default,,0000,0000,0000,,one is the tilde character this Dialogue: 0,0:17:16.57,0:17:21.13,Default,,0000,0000,0000,,character brings you to your home Dialogue: 0,0:17:18.34,0:17:23.14,Default,,0000,0000,0000,,directory so tilde always expands to the Dialogue: 0,0:17:21.13,0:17:25.78,Default,,0000,0000,0000,,home directory and you can do relative Dialogue: 0,0:17:23.14,0:17:30.04,Default,,0000,0000,0000,,paths to it so I can do tilde slash dev Dialogue: 0,0:17:25.78,0:17:32.98,Default,,0000,0000,0000,,slash P DOS classes missing semester and Dialogue: 0,0:17:30.04,0:17:36.67,Default,,0000,0000,0000,,now I'm there because tilde expanded to Dialogue: 0,0:17:32.98,0:17:39.46,Default,,0000,0000,0000,,slash home slash John there is also for Dialogue: 0,0:17:36.67,0:17:42.25,Default,,0000,0000,0000,,CD in particular a really handy argument Dialogue: 0,0:17:39.46,0:17:44.53,Default,,0000,0000,0000,,you can give which is - if you do CD - Dialogue: 0,0:17:42.25,0:17:47.38,Default,,0000,0000,0000,,it will CD to the directory you were Dialogue: 0,0:17:44.53,0:17:48.18,Default,,0000,0000,0000,,previously in so if I do CD - I go back Dialogue: 0,0:17:47.38,0:17:52.23,Default,,0000,0000,0000,,to root Dialogue: 0,0:17:48.18,0:17:53.88,Default,,0000,0000,0000,,if I do CD - again I go back to missing Dialogue: 0,0:17:52.23,0:17:55.08,Default,,0000,0000,0000,,semester so this is a handy way if you Dialogue: 0,0:17:53.88,0:18:01.29,Default,,0000,0000,0000,,want to toggle between two different Dialogue: 0,0:17:55.08,0:18:03.57,Default,,0000,0000,0000,,directories in the case of LS or in the Dialogue: 0,0:18:01.29,0:18:06.18,Default,,0000,0000,0000,,case of CD there might be arguments do Dialogue: 0,0:18:03.57,0:18:07.56,Default,,0000,0000,0000,,you don't know about right currently we Dialogue: 0,0:18:06.18,0:18:09.51,Default,,0000,0000,0000,,haven't really been doing anything Dialogue: 0,0:18:07.56,0:18:11.52,Default,,0000,0000,0000,,except giving paths but how do you even Dialogue: 0,0:18:09.51,0:18:14.25,Default,,0000,0000,0000,,discover that you can give a path to LS Dialogue: 0,0:18:11.52,0:18:16.53,Default,,0000,0000,0000,,in the first place well most programs Dialogue: 0,0:18:14.25,0:18:18.84,Default,,0000,0000,0000,,take what are known as arguments like Dialogue: 0,0:18:16.53,0:18:21.57,Default,,0000,0000,0000,,flags and options these are things that Dialogue: 0,0:18:18.84,0:18:24.81,Default,,0000,0000,0000,,usually start with a - one of the Hemi Dialogue: 0,0:18:21.57,0:18:26.88,Default,,0000,0000,0000,,is one of these is - help most programs Dialogue: 0,0:18:24.81,0:18:30.00,Default,,0000,0000,0000,,implement this and if you run for Dialogue: 0,0:18:26.88,0:18:34.02,Default,,0000,0000,0000,,example LS - help it all helpfully print Dialogue: 0,0:18:30.00,0:18:36.00,Default,,0000,0000,0000,,out a bunch of information about that Dialogue: 0,0:18:34.02,0:18:38.40,Default,,0000,0000,0000,,command and you'll see here that it says Dialogue: 0,0:18:36.00,0:18:40.26,Default,,0000,0000,0000,,the usage is LS and you can give some Dialogue: 0,0:18:38.40,0:18:42.03,Default,,0000,0000,0000,,number of options and you can give some Dialogue: 0,0:18:40.26,0:18:46.35,Default,,0000,0000,0000,,number of files the way to read that Dialogue: 0,0:18:42.03,0:18:48.60,Default,,0000,0000,0000,,usage line is triple dot means one like Dialogue: 0,0:18:46.35,0:18:50.85,Default,,0000,0000,0000,,zero or one or more and the square Dialogue: 0,0:18:48.60,0:18:52.89,Default,,0000,0000,0000,,bracket means optional so in this case Dialogue: 0,0:18:50.85,0:18:54.30,Default,,0000,0000,0000,,there's an optional number of options Dialogue: 0,0:18:52.89,0:18:56.79,Default,,0000,0000,0000,,and there's an optional number of files Dialogue: 0,0:18:54.30,0:18:58.74,Default,,0000,0000,0000,,and you'll see that it says what the Dialogue: 0,0:18:56.79,0:19:00.72,Default,,0000,0000,0000,,program does and also specifies a number Dialogue: 0,0:18:58.74,0:19:03.00,Default,,0000,0000,0000,,of different types of flags and options Dialogue: 0,0:19:00.72,0:19:04.95,Default,,0000,0000,0000,,you can give usually we call things that Dialogue: 0,0:19:03.00,0:19:07.83,Default,,0000,0000,0000,,are a single dash in a single letter a Dialogue: 0,0:19:04.95,0:19:09.90,Default,,0000,0000,0000,,flag and anything that or anything that Dialogue: 0,0:19:07.83,0:19:11.73,Default,,0000,0000,0000,,doesn't take a value a flag and anything Dialogue: 0,0:19:09.90,0:19:16.64,Default,,0000,0000,0000,,that does take a value an option so for Dialogue: 0,0:19:11.73,0:19:22.26,Default,,0000,0000,0000,,example - a and - all are both flags and Dialogue: 0,0:19:16.64,0:19:24.18,Default,,0000,0000,0000,,- C or - color R is an option one thing Dialogue: 0,0:19:22.26,0:19:30.33,Default,,0000,0000,0000,,you'll see under here if you scroll down Dialogue: 0,0:19:24.18,0:19:37.14,Default,,0000,0000,0000,,far enough is the - L flag and that's Dialogue: 0,0:19:30.33,0:19:39.48,Default,,0000,0000,0000,,unhelpful the - L flag the - L flag uses Dialogue: 0,0:19:37.14,0:19:40.86,Default,,0000,0000,0000,,a long listing format now that's Dialogue: 0,0:19:39.48,0:19:43.35,Default,,0000,0000,0000,,particularly helpful in and of itself Dialogue: 0,0:19:40.86,0:19:46.89,Default,,0000,0000,0000,,but let's see what it actually does so Dialogue: 0,0:19:43.35,0:19:48.45,Default,,0000,0000,0000,,if I do LS dash L it still prints the Dialogue: 0,0:19:46.89,0:19:49.89,Default,,0000,0000,0000,,files in the current directory but it Dialogue: 0,0:19:48.45,0:19:52.17,Default,,0000,0000,0000,,gives me a lot more information about Dialogue: 0,0:19:49.89,0:19:54.60,Default,,0000,0000,0000,,those files and this is something you'll Dialogue: 0,0:19:52.17,0:19:56.28,Default,,0000,0000,0000,,find yourself using quite a lot because Dialogue: 0,0:19:54.60,0:20:00.81,Default,,0000,0000,0000,,the additional information it gives you Dialogue: 0,0:19:56.28,0:20:02.01,Default,,0000,0000,0000,,is often quite handy let's look at what Dialogue: 0,0:20:00.81,0:20:09.03,Default,,0000,0000,0000,,some of that information Dialogue: 0,0:20:02.01,0:20:10.11,Default,,0000,0000,0000,,ah so first of all the D at the Dialogue: 0,0:20:09.03,0:20:11.76,Default,,0000,0000,0000,,beginning of some of these entries Dialogue: 0,0:20:10.11,0:20:14.82,Default,,0000,0000,0000,,indicate that something is a directory Dialogue: 0,0:20:11.76,0:20:16.02,Default,,0000,0000,0000,,so the underscore data entry here for Dialogue: 0,0:20:14.82,0:20:18.69,Default,,0000,0000,0000,,example is a directory Dialogue: 0,0:20:16.02,0:20:22.65,Default,,0000,0000,0000,,whereas for for hTML is not a directory Dialogue: 0,0:20:18.69,0:20:25.41,Default,,0000,0000,0000,,it's a file the following letters after Dialogue: 0,0:20:22.65,0:20:28.65,Default,,0000,0000,0000,,that indicate the permissions that are Dialogue: 0,0:20:25.41,0:20:30.81,Default,,0000,0000,0000,,set for that file so this like we saw Dialogue: 0,0:20:28.65,0:20:32.64,Default,,0000,0000,0000,,earlier I might not be able to open a Dialogue: 0,0:20:30.81,0:20:34.17,Default,,0000,0000,0000,,given file or I might not be able to CD Dialogue: 0,0:20:32.64,0:20:35.76,Default,,0000,0000,0000,,into a given directory and this is all Dialogue: 0,0:20:34.17,0:20:37.98,Default,,0000,0000,0000,,dictated by the permissions on that Dialogue: 0,0:20:35.76,0:20:41.43,Default,,0000,0000,0000,,particular file or directory the way to Dialogue: 0,0:20:37.98,0:20:43.50,Default,,0000,0000,0000,,read these is that the the first group Dialogue: 0,0:20:41.43,0:20:45.81,Default,,0000,0000,0000,,of three are the permissions are set for Dialogue: 0,0:20:43.50,0:20:49.56,Default,,0000,0000,0000,,the owner of the file all of these files Dialogue: 0,0:20:45.81,0:20:52.02,Default,,0000,0000,0000,,you'll see are owned by me the second Dialogue: 0,0:20:49.56,0:20:53.88,Default,,0000,0000,0000,,group of three characters is for the Dialogue: 0,0:20:52.02,0:20:56.10,Default,,0000,0000,0000,,permissions for the group that owns this Dialogue: 0,0:20:53.88,0:20:58.65,Default,,0000,0000,0000,,file in this case all of these files are Dialogue: 0,0:20:56.10,0:21:01.77,Default,,0000,0000,0000,,also known by the john group and a final Dialogue: 0,0:20:58.65,0:21:03.90,Default,,0000,0000,0000,,group of three is a list of the Dialogue: 0,0:21:01.77,0:21:06.29,Default,,0000,0000,0000,,permissions for everyone else so anyone Dialogue: 0,0:21:03.90,0:21:08.55,Default,,0000,0000,0000,,who's not a user owner or a group owner Dialogue: 0,0:21:06.29,0:21:10.98,Default,,0000,0000,0000,,this directory is perhaps kind of boring Dialogue: 0,0:21:08.55,0:21:14.19,Default,,0000,0000,0000,,because all of the things are owned by Dialogue: 0,0:21:10.98,0:21:17.49,Default,,0000,0000,0000,,me but if we do something like CD to Dialogue: 0,0:21:14.19,0:21:20.28,Default,,0000,0000,0000,,slash and do LS dash L you'll see that Dialogue: 0,0:21:17.49,0:21:22.80,Default,,0000,0000,0000,,here all of them are owned by root we'll Dialogue: 0,0:21:20.28,0:21:24.09,Default,,0000,0000,0000,,get back to what the root user is but Dialogue: 0,0:21:22.80,0:21:26.40,Default,,0000,0000,0000,,here you see some of the permissions are Dialogue: 0,0:21:24.09,0:21:31.41,Default,,0000,0000,0000,,a little bit more interesting the groups Dialogue: 0,0:21:26.40,0:21:34.29,Default,,0000,0000,0000,,of three are read write and execute what Dialogue: 0,0:21:31.41,0:21:36.45,Default,,0000,0000,0000,,these mean differs for files and for Dialogue: 0,0:21:34.29,0:21:37.98,Default,,0000,0000,0000,,directories for files it's pretty Dialogue: 0,0:21:36.45,0:21:40.17,Default,,0000,0000,0000,,straightforward if you have read Dialogue: 0,0:21:37.98,0:21:41.82,Default,,0000,0000,0000,,permissions on a file then you can read Dialogue: 0,0:21:40.17,0:21:43.95,Default,,0000,0000,0000,,its contents if you have write Dialogue: 0,0:21:41.82,0:21:46.20,Default,,0000,0000,0000,,permissions on a file then you can save Dialogue: 0,0:21:43.95,0:21:48.27,Default,,0000,0000,0000,,the file you can add more to it or you Dialogue: 0,0:21:46.20,0:21:50.67,Default,,0000,0000,0000,,can replace it entirely and if you have Dialogue: 0,0:21:48.27,0:21:52.62,Default,,0000,0000,0000,,execute to the X bit on a file then Dialogue: 0,0:21:50.67,0:21:57.39,Default,,0000,0000,0000,,you're allowed to execute that file so Dialogue: 0,0:21:52.62,0:22:00.03,Default,,0000,0000,0000,,if we do LS al in slash bin that's a Dialogue: 0,0:21:57.39,0:22:02.64,Default,,0000,0000,0000,,novel and user bin you'll see that all Dialogue: 0,0:22:00.03,0:22:04.59,Default,,0000,0000,0000,,of them have the execute bit set even Dialogue: 0,0:22:02.64,0:22:06.48,Default,,0000,0000,0000,,for people who are not the owner of the Dialogue: 0,0:22:04.59,0:22:08.28,Default,,0000,0000,0000,,file and this is because the echo Dialogue: 0,0:22:06.48,0:22:09.42,Default,,0000,0000,0000,,program for example we want everyone on Dialogue: 0,0:22:08.28,0:22:11.70,Default,,0000,0000,0000,,the computer to be able to execute Dialogue: 0,0:22:09.42,0:22:13.92,Default,,0000,0000,0000,,there's no reason to say only certain Dialogue: 0,0:22:11.70,0:22:15.57,Default,,0000,0000,0000,,users can run echo that doesn't really Dialogue: 0,0:22:13.92,0:22:18.42,Default,,0000,0000,0000,,make any make any sense Dialogue: 0,0:22:15.57,0:22:20.96,Default,,0000,0000,0000,,for directories though these permissions Dialogue: 0,0:22:18.42,0:22:23.55,Default,,0000,0000,0000,,are a little bit different so read Dialogue: 0,0:22:20.96,0:22:26.46,Default,,0000,0000,0000,,translates - are you allowed to see Dialogue: 0,0:22:23.55,0:22:28.77,Default,,0000,0000,0000,,which files are inside this directory so Dialogue: 0,0:22:26.46,0:22:30.53,Default,,0000,0000,0000,,think of read as lists for a directory Dialogue: 0,0:22:28.77,0:22:33.42,Default,,0000,0000,0000,,are you allowed to list its contents Dialogue: 0,0:22:30.53,0:22:36.21,Default,,0000,0000,0000,,write for a directory is whether you are Dialogue: 0,0:22:33.42,0:22:39.09,Default,,0000,0000,0000,,allowed to rename create or remove files Dialogue: 0,0:22:36.21,0:22:42.03,Default,,0000,0000,0000,,within that directory so it's still kind Dialogue: 0,0:22:39.09,0:22:45.24,Default,,0000,0000,0000,,of right but notice that this means that Dialogue: 0,0:22:42.03,0:22:47.58,Default,,0000,0000,0000,,if you have write permissions on a file Dialogue: 0,0:22:45.24,0:22:49.95,Default,,0000,0000,0000,,but you do not have write permissions on Dialogue: 0,0:22:47.58,0:22:52.08,Default,,0000,0000,0000,,its directory you cannot delete the file Dialogue: 0,0:22:49.95,0:22:54.42,Default,,0000,0000,0000,,you can empty it but you cannot delete Dialogue: 0,0:22:52.08,0:22:57.66,Default,,0000,0000,0000,,it because that would require writing to Dialogue: 0,0:22:54.42,0:22:59.13,Default,,0000,0000,0000,,the directory itself and finally execute Dialogue: 0,0:22:57.66,0:23:01.95,Default,,0000,0000,0000,,on directories is something that trips Dialogue: 0,0:22:59.13,0:23:04.65,Default,,0000,0000,0000,,people up a lot execute on a directory Dialogue: 0,0:23:01.95,0:23:07.23,Default,,0000,0000,0000,,is what's known as search and that's not Dialogue: 0,0:23:04.65,0:23:10.20,Default,,0000,0000,0000,,terribly helpful a name but what that Dialogue: 0,0:23:07.23,0:23:13.47,Default,,0000,0000,0000,,means is are you allowed to enter this Dialogue: 0,0:23:10.20,0:23:15.24,Default,,0000,0000,0000,,directory if you want to get to a file Dialogue: 0,0:23:13.47,0:23:16.67,Default,,0000,0000,0000,,if you want to open it or read it or Dialogue: 0,0:23:15.24,0:23:20.31,Default,,0000,0000,0000,,write it whatever you want to do Dialogue: 0,0:23:16.67,0:23:22.71,Default,,0000,0000,0000,,basically to CD into a directory you Dialogue: 0,0:23:20.31,0:23:25.05,Default,,0000,0000,0000,,must have the execute permission on all Dialogue: 0,0:23:22.71,0:23:28.17,Default,,0000,0000,0000,,parent directories of that directory and Dialogue: 0,0:23:25.05,0:23:30.48,Default,,0000,0000,0000,,the directory itself so for example for Dialogue: 0,0:23:28.17,0:23:34.08,Default,,0000,0000,0000,,me to access a file inside slash user Dialogue: 0,0:23:30.48,0:23:35.82,Default,,0000,0000,0000,,slash bin such as user bin echo I must Dialogue: 0,0:23:34.08,0:23:38.10,Default,,0000,0000,0000,,have executed on route I must have Dialogue: 0,0:23:35.82,0:23:40.38,Default,,0000,0000,0000,,execute on user and I must have execute Dialogue: 0,0:23:38.10,0:23:42.12,Default,,0000,0000,0000,,on bin if I do not have all those Dialogue: 0,0:23:40.38,0:23:44.79,Default,,0000,0000,0000,,execute bits I will not be allowed to Dialogue: 0,0:23:42.12,0:23:48.41,Default,,0000,0000,0000,,access that file because I won't be able Dialogue: 0,0:23:44.79,0:23:50.67,Default,,0000,0000,0000,,to enter the directories along the way Dialogue: 0,0:23:48.41,0:23:52.56,Default,,0000,0000,0000,,there are a number of other bits that Dialogue: 0,0:23:50.67,0:23:55.32,Default,,0000,0000,0000,,you might come across like you might see Dialogue: 0,0:23:52.56,0:23:58.02,Default,,0000,0000,0000,,esses or T's in these lists you might Dialogue: 0,0:23:55.32,0:23:58.95,Default,,0000,0000,0000,,see LS those we can talk about in office Dialogue: 0,0:23:58.02,0:24:01.26,Default,,0000,0000,0000,,hours if you're curious Dialogue: 0,0:23:58.95,0:24:04.26,Default,,0000,0000,0000,,they will mostly not matter for anything Dialogue: 0,0:24:01.26,0:24:05.67,Default,,0000,0000,0000,,you will do in this class but they are Dialogue: 0,0:24:04.26,0:24:08.10,Default,,0000,0000,0000,,handy to know about so if you're curious Dialogue: 0,0:24:05.67,0:24:11.34,Default,,0000,0000,0000,,about them look them up on your own or Dialogue: 0,0:24:08.10,0:24:13.08,Default,,0000,0000,0000,,come ask us in office hours there are Dialogue: 0,0:24:11.34,0:24:14.58,Default,,0000,0000,0000,,some other programs that are handy to Dialogue: 0,0:24:13.08,0:24:16.20,Default,,0000,0000,0000,,know about oh sorry there's one more Dialogue: 0,0:24:14.58,0:24:17.40,Default,,0000,0000,0000,,thing as I mentioned if you just have a Dialogue: 0,0:24:16.20,0:24:19.47,Default,,0000,0000,0000,,dash it means you do not have that Dialogue: 0,0:24:17.40,0:24:21.81,Default,,0000,0000,0000,,permission right so if it says for Dialogue: 0,0:24:19.47,0:24:23.19,Default,,0000,0000,0000,,example our dash X it means that you Dialogue: 0,0:24:21.81,0:24:27.39,Default,,0000,0000,0000,,have read and execute but you do not Dialogue: 0,0:24:23.19,0:24:29.24,Default,,0000,0000,0000,,have right there are some other handy Dialogue: 0,0:24:27.39,0:24:32.36,Default,,0000,0000,0000,,programs to know about at this point Dialogue: 0,0:24:29.24,0:24:35.45,Default,,0000,0000,0000,,one of them is move or the MV command so Dialogue: 0,0:24:32.36,0:24:39.35,Default,,0000,0000,0000,,if I CD back to missing semester here MV Dialogue: 0,0:24:35.45,0:24:42.95,Default,,0000,0000,0000,,lets me rename a file and rename here Dialogue: 0,0:24:39.35,0:24:45.32,Default,,0000,0000,0000,,takes two paths it takes the old path in Dialogue: 0,0:24:42.95,0:24:47.87,Default,,0000,0000,0000,,the new path this is means that move Dialogue: 0,0:24:45.32,0:24:49.97,Default,,0000,0000,0000,,lets you both rename a file like if you Dialogue: 0,0:24:47.87,0:24:52.13,Default,,0000,0000,0000,,change the name of the file but not the Dialogue: 0,0:24:49.97,0:24:54.29,Default,,0000,0000,0000,,directory or it lets you move a file to Dialogue: 0,0:24:52.13,0:24:56.36,Default,,0000,0000,0000,,a completely different directory it just Dialogue: 0,0:24:54.29,0:24:57.89,Default,,0000,0000,0000,,you give the path to the current file Dialogue: 0,0:24:56.36,0:24:59.72,Default,,0000,0000,0000,,and the path to where you want that file Dialogue: 0,0:24:57.89,0:25:02.72,Default,,0000,0000,0000,,to be and that can change its location Dialogue: 0,0:24:59.72,0:25:05.48,Default,,0000,0000,0000,,and its name so for example I can move Dialogue: 0,0:25:02.72,0:25:09.02,Default,,0000,0000,0000,,dot files dot MD to be food MD Dialogue: 0,0:25:05.48,0:25:16.28,Default,,0000,0000,0000,,unhelpfully right and similarly I can Dialogue: 0,0:25:09.02,0:25:19.37,Default,,0000,0000,0000,,move it back there's also the CP command Dialogue: 0,0:25:16.28,0:25:21.86,Default,,0000,0000,0000,,the CP or copy is very similar it lets Dialogue: 0,0:25:19.37,0:25:23.75,Default,,0000,0000,0000,,you copy a file CP also takes two Dialogue: 0,0:25:21.86,0:25:25.61,Default,,0000,0000,0000,,arguments it takes the path you want to Dialogue: 0,0:25:23.75,0:25:28.34,Default,,0000,0000,0000,,copy from and the path you want to copy Dialogue: 0,0:25:25.61,0:25:30.89,Default,,0000,0000,0000,,to and these are full paths so I could Dialogue: 0,0:25:28.34,0:25:32.96,Default,,0000,0000,0000,,use this for example to say I want to Dialogue: 0,0:25:30.89,0:25:37.55,Default,,0000,0000,0000,,copy dot files out MD - dot dot slash Dialogue: 0,0:25:32.96,0:25:39.71,Default,,0000,0000,0000,,food MD sure food MD and now if I do LS Dialogue: 0,0:25:37.55,0:25:42.80,Default,,0000,0000,0000,,dot you'll see that there's a food MD Dialogue: 0,0:25:39.71,0:25:44.60,Default,,0000,0000,0000,,file in that directory so CP as well Dialogue: 0,0:25:42.80,0:25:47.78,Default,,0000,0000,0000,,take two paths it does not have to be in Dialogue: 0,0:25:44.60,0:25:49.70,Default,,0000,0000,0000,,the same directory and similarly there's Dialogue: 0,0:25:47.78,0:25:52.07,Default,,0000,0000,0000,,the RM command which lets you remove a Dialogue: 0,0:25:49.70,0:25:54.05,Default,,0000,0000,0000,,file and there - you can give paths in Dialogue: 0,0:25:52.07,0:25:56.75,Default,,0000,0000,0000,,this case I'm removing dot dot slash Dialogue: 0,0:25:54.05,0:25:59.48,Default,,0000,0000,0000,,food you should be aware for removing Dialogue: 0,0:25:56.75,0:26:01.94,Default,,0000,0000,0000,,especially on Linux removal is by Dialogue: 0,0:25:59.48,0:26:05.00,Default,,0000,0000,0000,,default not recursive so you cannot Dialogue: 0,0:26:01.94,0:26:07.10,Default,,0000,0000,0000,,remove a directory using RM you can pass Dialogue: 0,0:26:05.00,0:26:09.32,Default,,0000,0000,0000,,the - our flag which lets you do a Dialogue: 0,0:26:07.10,0:26:10.55,Default,,0000,0000,0000,,recursive remove and then give a path Dialogue: 0,0:26:09.32,0:26:12.89,Default,,0000,0000,0000,,that you want to remove and it will Dialogue: 0,0:26:10.55,0:26:16.37,Default,,0000,0000,0000,,remove everything below it there is also Dialogue: 0,0:26:12.89,0:26:18.29,Default,,0000,0000,0000,,the RM dr dir command which lets you Dialogue: 0,0:26:16.37,0:26:21.23,Default,,0000,0000,0000,,remove a directory but it only lets you Dialogue: 0,0:26:18.29,0:26:22.97,Default,,0000,0000,0000,,remove that directory if it is empty so Dialogue: 0,0:26:21.23,0:26:23.96,Default,,0000,0000,0000,,the idea here is to sort of be a safety Dialogue: 0,0:26:22.97,0:26:25.43,Default,,0000,0000,0000,,mechanism for you so you don't Dialogue: 0,0:26:23.96,0:26:28.61,Default,,0000,0000,0000,,accidentally throw away a bunch of your Dialogue: 0,0:26:25.43,0:26:31.04,Default,,0000,0000,0000,,files and the final little command Dialogue: 0,0:26:28.61,0:26:32.54,Default,,0000,0000,0000,,that's handy to use is make there which Dialogue: 0,0:26:31.04,0:26:34.43,Default,,0000,0000,0000,,lets you create a new directory and as Dialogue: 0,0:26:32.54,0:26:36.11,Default,,0000,0000,0000,,we talked about before you don't want to Dialogue: 0,0:26:34.43,0:26:37.94,Default,,0000,0000,0000,,do something like this because it will Dialogue: 0,0:26:36.11,0:26:40.58,Default,,0000,0000,0000,,create two directories for you one Dialogue: 0,0:26:37.94,0:26:42.14,Default,,0000,0000,0000,,called my and one called photos if you Dialogue: 0,0:26:40.58,0:26:42.98,Default,,0000,0000,0000,,actually want to create a directory like Dialogue: 0,0:26:42.14,0:26:50.12,Default,,0000,0000,0000,,this you would either Dialogue: 0,0:26:42.98,0:26:52.52,Default,,0000,0000,0000,,escape the space or quote the string if Dialogue: 0,0:26:50.12,0:26:54.92,Default,,0000,0000,0000,,you ever want more information about how Dialogue: 0,0:26:52.52,0:26:57.05,Default,,0000,0000,0000,,any command to basically on these Dialogue: 0,0:26:54.92,0:26:58.22,Default,,0000,0000,0000,,platforms work there's a really handy Dialogue: 0,0:26:57.05,0:27:00.65,Default,,0000,0000,0000,,command for that as well Dialogue: 0,0:26:58.22,0:27:04.61,Default,,0000,0000,0000,,there is the program called man for Dialogue: 0,0:27:00.65,0:27:06.41,Default,,0000,0000,0000,,manual pages this program takes as an Dialogue: 0,0:27:04.61,0:27:09.08,Default,,0000,0000,0000,,argument the name of another program and Dialogue: 0,0:27:06.41,0:27:12.02,Default,,0000,0000,0000,,gives you its manual page so for example Dialogue: 0,0:27:09.08,0:27:14.99,Default,,0000,0000,0000,,we could do man LS and this shows us a Dialogue: 0,0:27:12.02,0:27:16.73,Default,,0000,0000,0000,,manual page for LS you'll notice that in Dialogue: 0,0:27:14.99,0:27:19.25,Default,,0000,0000,0000,,the case of LS it is fairly similar to Dialogue: 0,0:27:16.73,0:27:20.87,Default,,0000,0000,0000,,what we got with LS - help but it's a Dialogue: 0,0:27:19.25,0:27:23.57,Default,,0000,0000,0000,,little easier to navigate a little Dialogue: 0,0:27:20.87,0:27:26.27,Default,,0000,0000,0000,,easier to read usually towards the Dialogue: 0,0:27:23.57,0:27:28.64,Default,,0000,0000,0000,,bottom you will also get examples Dialogue: 0,0:27:26.27,0:27:29.90,Default,,0000,0000,0000,,information about who wrote it where you Dialogue: 0,0:27:28.64,0:27:32.39,Default,,0000,0000,0000,,can find more information and that sort Dialogue: 0,0:27:29.90,0:27:32.99,Default,,0000,0000,0000,,of stuff one thing that can be confusing Dialogue: 0,0:27:32.39,0:27:35.33,Default,,0000,0000,0000,,sometimes Dialogue: 0,0:27:32.99,0:27:36.29,Default,,0000,0000,0000,,at least until a recent version where Dialogue: 0,0:27:35.33,0:27:38.78,Default,,0000,0000,0000,,they added this three at the bottom Dialogue: 0,0:27:36.29,0:27:41.39,Default,,0000,0000,0000,,which says Q to quit they do not use to Dialogue: 0,0:27:38.78,0:27:43.28,Default,,0000,0000,0000,,say this you press Q to quit this Dialogue: 0,0:27:41.39,0:27:48.17,Default,,0000,0000,0000,,program it can be really hard to quit it Dialogue: 0,0:27:43.28,0:27:50.75,Default,,0000,0000,0000,,if you do not know that a handy keyboard Dialogue: 0,0:27:48.17,0:27:52.97,Default,,0000,0000,0000,,shortcut here by the way is ctrl L which Dialogue: 0,0:27:50.75,0:27:56.99,Default,,0000,0000,0000,,lets you clear your terminal and go back Dialogue: 0,0:27:52.97,0:27:59.33,Default,,0000,0000,0000,,to the top so so far we've only talked Dialogue: 0,0:27:56.99,0:28:01.37,Default,,0000,0000,0000,,about programs in isolation but where Dialogue: 0,0:27:59.33,0:28:03.02,Default,,0000,0000,0000,,much of the power of the shell really Dialogue: 0,0:28:01.37,0:28:06.38,Default,,0000,0000,0000,,comes through is once you start Dialogue: 0,0:28:03.02,0:28:08.42,Default,,0000,0000,0000,,combining different programs right so Dialogue: 0,0:28:06.38,0:28:10.79,Default,,0000,0000,0000,,rather than just like running CDE Dialogue: 0,0:28:08.42,0:28:12.50,Default,,0000,0000,0000,,running LS and etc you might want to Dialogue: 0,0:28:10.79,0:28:13.94,Default,,0000,0000,0000,,chain multiple programs together you Dialogue: 0,0:28:12.50,0:28:15.98,Default,,0000,0000,0000,,might want to interact with files and Dialogue: 0,0:28:13.94,0:28:19.31,Default,,0000,0000,0000,,have files operate in between programs Dialogue: 0,0:28:15.98,0:28:21.20,Default,,0000,0000,0000,,and the way we can do this is using this Dialogue: 0,0:28:19.31,0:28:24.62,Default,,0000,0000,0000,,notion of streams that the shell gives Dialogue: 0,0:28:21.20,0:28:25.94,Default,,0000,0000,0000,,us every program by default has I'm Dialogue: 0,0:28:24.62,0:28:28.61,Default,,0000,0000,0000,,gonna simplify a little and say two Dialogue: 0,0:28:25.94,0:28:31.82,Default,,0000,0000,0000,,primary streams it has an input stream Dialogue: 0,0:28:28.61,0:28:33.95,Default,,0000,0000,0000,,and an output stream by default the Dialogue: 0,0:28:31.82,0:28:35.42,Default,,0000,0000,0000,,input stream is your keyboard basically Dialogue: 0,0:28:33.95,0:28:36.86,Default,,0000,0000,0000,,the input stream is your terminal and Dialogue: 0,0:28:35.42,0:28:38.93,Default,,0000,0000,0000,,whatever you type into your terminal is Dialogue: 0,0:28:36.86,0:28:40.61,Default,,0000,0000,0000,,going to end up into the program and it Dialogue: 0,0:28:38.93,0:28:42.05,Default,,0000,0000,0000,,has a default output stream which is Dialogue: 0,0:28:40.61,0:28:44.33,Default,,0000,0000,0000,,whenever the program prints something Dialogue: 0,0:28:42.05,0:28:46.28,Default,,0000,0000,0000,,it's gonna print to that stream and by Dialogue: 0,0:28:44.33,0:28:48.47,Default,,0000,0000,0000,,default that is also your terminal this Dialogue: 0,0:28:46.28,0:28:50.69,Default,,0000,0000,0000,,is why when I type echo hello it gets Dialogue: 0,0:28:48.47,0:28:54.20,Default,,0000,0000,0000,,printed back to my terminal but the Dialogue: 0,0:28:50.69,0:28:56.36,Default,,0000,0000,0000,,shell gives you a way to rewire these Dialogue: 0,0:28:54.20,0:28:59.12,Default,,0000,0000,0000,,streams to change where the input Dialogue: 0,0:28:56.36,0:29:00.98,Default,,0000,0000,0000,,output of a programmer pointed the way Dialogue: 0,0:28:59.12,0:29:06.20,Default,,0000,0000,0000,,the most straightforward way you do this Dialogue: 0,0:29:00.98,0:29:08.21,Default,,0000,0000,0000,,is using the angle bracket signs so you Dialogue: 0,0:29:06.20,0:29:11.57,Default,,0000,0000,0000,,can write something like this or you can Dialogue: 0,0:29:08.21,0:29:14.30,Default,,0000,0000,0000,,write something like this the left angle Dialogue: 0,0:29:11.57,0:29:16.34,Default,,0000,0000,0000,,bracket indicates rewire the input for Dialogue: 0,0:29:14.30,0:29:21.04,Default,,0000,0000,0000,,this program to be the contents of this Dialogue: 0,0:29:16.34,0:29:23.60,Default,,0000,0000,0000,,file and the end angle bracket means Dialogue: 0,0:29:21.04,0:29:27.56,Default,,0000,0000,0000,,rewire the output of the preceding Dialogue: 0,0:29:23.60,0:29:28.58,Default,,0000,0000,0000,,program into this file so let's look at Dialogue: 0,0:29:27.56,0:29:32.24,Default,,0000,0000,0000,,an example of what that would look like Dialogue: 0,0:29:28.58,0:29:34.28,Default,,0000,0000,0000,,if I do echo hello I can say I want that Dialogue: 0,0:29:32.24,0:29:36.71,Default,,0000,0000,0000,,context the content to be stored in a Dialogue: 0,0:29:34.28,0:29:39.05,Default,,0000,0000,0000,,file called hello dot text and because I Dialogue: 0,0:29:36.71,0:29:40.52,Default,,0000,0000,0000,,gave this is a relative path right this Dialogue: 0,0:29:39.05,0:29:42.98,Default,,0000,0000,0000,,will construct a file in the current Dialogue: 0,0:29:40.52,0:29:45.44,Default,,0000,0000,0000,,directory called hello text and at least Dialogue: 0,0:29:42.98,0:29:47.78,Default,,0000,0000,0000,,in theory its contents should be the Dialogue: 0,0:29:45.44,0:29:50.36,Default,,0000,0000,0000,,word hello so if I run this notice that Dialogue: 0,0:29:47.78,0:29:52.10,Default,,0000,0000,0000,,nothing got printed to my output the Dialogue: 0,0:29:50.36,0:29:52.70,Default,,0000,0000,0000,,previous time when I ran echo hello it Dialogue: 0,0:29:52.10,0:29:55.34,Default,,0000,0000,0000,,printed hello Dialogue: 0,0:29:52.70,0:29:57.80,Default,,0000,0000,0000,,now that hello is going gone into a file Dialogue: 0,0:29:55.34,0:30:00.61,Default,,0000,0000,0000,,called hello text and I can verify this Dialogue: 0,0:29:57.80,0:30:03.86,Default,,0000,0000,0000,,by using the program called cat so cat Dialogue: 0,0:30:00.61,0:30:07.28,Default,,0000,0000,0000,,prints the contents of a file so I can Dialogue: 0,0:30:03.86,0:30:11.06,Default,,0000,0000,0000,,do cat hello dot txt and there it shows Dialogue: 0,0:30:07.28,0:30:13.22,Default,,0000,0000,0000,,me hello but cat is a is also something Dialogue: 0,0:30:11.06,0:30:16.22,Default,,0000,0000,0000,,that supports this kind of wiring so I Dialogue: 0,0:30:13.22,0:30:17.99,Default,,0000,0000,0000,,can say cat which by default just prints Dialogue: 0,0:30:16.22,0:30:20.72,Default,,0000,0000,0000,,its input it just duplicates its input Dialogue: 0,0:30:17.99,0:30:23.81,Default,,0000,0000,0000,,to its output I can say I want you to Dialogue: 0,0:30:20.72,0:30:25.16,Default,,0000,0000,0000,,take your input from Hello text what Dialogue: 0,0:30:23.81,0:30:26.99,Default,,0000,0000,0000,,will happen in this case is that the Dialogue: 0,0:30:25.16,0:30:29.84,Default,,0000,0000,0000,,shell is going to open hello dot txt Dialogue: 0,0:30:26.99,0:30:32.54,Default,,0000,0000,0000,,take its contents and set that to be the Dialogue: 0,0:30:29.84,0:30:34.37,Default,,0000,0000,0000,,input of cat and then cat is going to Dialogue: 0,0:30:32.54,0:30:36.50,Default,,0000,0000,0000,,just print that to its output which Dialogue: 0,0:30:34.37,0:30:38.18,Default,,0000,0000,0000,,since I haven't rewired it is gonna be Dialogue: 0,0:30:36.50,0:30:41.87,Default,,0000,0000,0000,,my terminal so this will just print Dialogue: 0,0:30:38.18,0:30:43.55,Default,,0000,0000,0000,,hello to the output and I can use both Dialogue: 0,0:30:41.87,0:30:45.47,Default,,0000,0000,0000,,of these at the same time so for example Dialogue: 0,0:30:43.55,0:30:47.00,Default,,0000,0000,0000,,if I want to copy a file and I don't Dialogue: 0,0:30:45.47,0:30:51.50,Default,,0000,0000,0000,,want to use the CP command for some Dialogue: 0,0:30:47.00,0:30:54.47,Default,,0000,0000,0000,,reason I can do this and in this case Dialogue: 0,0:30:51.50,0:30:56.54,Default,,0000,0000,0000,,I'm telling the cat program nothing at Dialogue: 0,0:30:54.47,0:30:58.01,Default,,0000,0000,0000,,all I'm just saying do your normal thing Dialogue: 0,0:30:56.54,0:30:59.96,Default,,0000,0000,0000,,right the cat program does not know Dialogue: 0,0:30:58.01,0:31:02.15,Default,,0000,0000,0000,,anything about this redirection but I'm Dialogue: 0,0:30:59.96,0:31:04.19,Default,,0000,0000,0000,,telling the shell to use hello dot txt as Dialogue: 0,0:31:02.15,0:31:08.12,Default,,0000,0000,0000,,the input for cat and to write anything Dialogue: 0,0:31:04.19,0:31:09.47,Default,,0000,0000,0000,,that cat prints - hello - dot txt again Dialogue: 0,0:31:08.12,0:31:10.01,Default,,0000,0000,0000,,this prints nothing to my terminal Dialogue: 0,0:31:09.47,0:31:13.34,Default,,0000,0000,0000,,but if Dialogue: 0,0:31:10.01,0:31:15.62,Default,,0000,0000,0000,,cat hello to text I get the output as I Dialogue: 0,0:31:13.34,0:31:20.63,Default,,0000,0000,0000,,would have expected which is a copy of Dialogue: 0,0:31:15.62,0:31:23.39,Default,,0000,0000,0000,,the original file there is also a double Dialogue: 0,0:31:20.63,0:31:26.57,Default,,0000,0000,0000,,end bracket which is append instead of Dialogue: 0,0:31:23.39,0:31:27.38,Default,,0000,0000,0000,,just overwrite so you'll notice that I Dialogue: 0,0:31:26.57,0:31:29.87,Default,,0000,0000,0000,,if I do Dialogue: 0,0:31:27.38,0:31:32.30,Default,,0000,0000,0000,,cat hello dot txt - hello - dot txt Dialogue: 0,0:31:29.87,0:31:34.16,Default,,0000,0000,0000,,again and then I cat hello2 dot txt it Dialogue: 0,0:31:32.30,0:31:36.50,Default,,0000,0000,0000,,still just contains hello even though it Dialogue: 0,0:31:34.16,0:31:38.75,Default,,0000,0000,0000,,already contained hello if I switch that Dialogue: 0,0:31:36.50,0:31:41.09,Default,,0000,0000,0000,,to instead be a double end bracket it Dialogue: 0,0:31:38.75,0:31:45.89,Default,,0000,0000,0000,,means append and if I now cat that file Dialogue: 0,0:31:41.09,0:31:47.57,Default,,0000,0000,0000,,it has a hello twice these are pretty Dialogue: 0,0:31:45.89,0:31:49.85,Default,,0000,0000,0000,,straightforward they're usually just Dialogue: 0,0:31:47.57,0:31:51.59,Default,,0000,0000,0000,,ways to interact with files but where it Dialogue: 0,0:31:49.85,0:31:53.42,Default,,0000,0000,0000,,gets really interesting is an additional Dialogue: 0,0:31:51.59,0:31:56.15,Default,,0000,0000,0000,,operator the shell gives you called the Dialogue: 0,0:31:53.42,0:32:00.02,Default,,0000,0000,0000,,pipe character so pipe is just a Dialogue: 0,0:31:56.15,0:32:02.90,Default,,0000,0000,0000,,vertical bar and what pipe means is take Dialogue: 0,0:32:00.02,0:32:05.30,Default,,0000,0000,0000,,the output of the program to the left Dialogue: 0,0:32:02.90,0:32:09.65,Default,,0000,0000,0000,,and make it the input of the program to Dialogue: 0,0:32:05.30,0:32:13.94,Default,,0000,0000,0000,,the right right so what does this look Dialogue: 0,0:32:09.65,0:32:17.45,Default,,0000,0000,0000,,like well let's take the example of ls / Dialogue: 0,0:32:13.94,0:32:19.55,Default,,0000,0000,0000,,or ls dash l / this prints a bunch of Dialogue: 0,0:32:17.45,0:32:22.46,Default,,0000,0000,0000,,things let's say that I only wanted the Dialogue: 0,0:32:19.55,0:32:25.67,Default,,0000,0000,0000,,last line of this output well there's a Dialogue: 0,0:32:22.46,0:32:28.94,Default,,0000,0000,0000,,command called tail and tail prints the Dialogue: 0,0:32:25.67,0:32:32.42,Default,,0000,0000,0000,,last n lines of its input and I can do Dialogue: 0,0:32:28.94,0:32:34.52,Default,,0000,0000,0000,,-n1 so this is a flag called n you Dialogue: 0,0:32:32.42,0:32:36.89,Default,,0000,0000,0000,,can also use dash dash lines if you want Dialogue: 0,0:32:34.52,0:32:38.66,Default,,0000,0000,0000,,to use it as a longer option but in this Dialogue: 0,0:32:36.89,0:32:42.26,Default,,0000,0000,0000,,case this is saying just print the last Dialogue: 0,0:32:38.66,0:32:46.64,Default,,0000,0000,0000,,line and I can wire these together so I Dialogue: 0,0:32:42.26,0:32:50.84,Default,,0000,0000,0000,,can say ls dash l / pipe tail -n1 Dialogue: 0,0:32:46.64,0:32:53.06,Default,,0000,0000,0000,,and notice here that ls does not know Dialogue: 0,0:32:50.84,0:32:55.34,Default,,0000,0000,0000,,about tail and tail does not know about Dialogue: 0,0:32:53.06,0:32:56.87,Default,,0000,0000,0000,,ls they are different programs and have Dialogue: 0,0:32:55.34,0:32:59.12,Default,,0000,0000,0000,,never been programmed to be compatible Dialogue: 0,0:32:56.87,0:33:00.65,Default,,0000,0000,0000,,with one another all they know how to do Dialogue: 0,0:32:59.12,0:33:02.90,Default,,0000,0000,0000,,is read from input and write to output Dialogue: 0,0:33:00.65,0:33:05.36,Default,,0000,0000,0000,,and then the pipe is what wires them Dialogue: 0,0:33:02.90,0:33:07.67,Default,,0000,0000,0000,,together and in this particular case I'm Dialogue: 0,0:33:05.36,0:33:09.38,Default,,0000,0000,0000,,saying I want the output of LS to be the Dialogue: 0,0:33:07.67,0:33:10.85,Default,,0000,0000,0000,,input to tail and then I want the output Dialogue: 0,0:33:09.38,0:33:12.14,Default,,0000,0000,0000,,of tail to just go to my terminal Dialogue: 0,0:33:10.85,0:33:14.24,Default,,0000,0000,0000,,because I haven't rewired it Dialogue: 0,0:33:12.14,0:33:16.73,Default,,0000,0000,0000,,I could also rewire this to say I want Dialogue: 0,0:33:14.24,0:33:18.77,Default,,0000,0000,0000,,the output to go to ls dot text and in this Dialogue: 0,0:33:16.73,0:33:20.99,Default,,0000,0000,0000,,case if I cat ls dot text I would get Dialogue: 0,0:33:18.77,0:33:22.64,Default,,0000,0000,0000,,the appropriate output and it turns out Dialogue: 0,0:33:20.99,0:33:21.82,Default,,0000,0000,0000,,you can do some really neat things with this Dialogue: 0,0:33:23.34,0:33:27.72,Default,,0000,0000,0000,,gonna cover this a lot more in the data Dialogue: 0,0:33:25.11,0:33:30.72,Default,,0000,0000,0000,,wrangling lecture there will be in like Dialogue: 0,0:33:27.72,0:33:32.49,Default,,0000,0000,0000,,four days or something on the kind of Dialogue: 0,0:33:30.72,0:33:36.06,Default,,0000,0000,0000,,fancy stuff you can do when you start Dialogue: 0,0:33:32.49,0:33:37.56,Default,,0000,0000,0000,,building more advanced pipelines one to Dialogue: 0,0:33:36.06,0:33:42.30,Default,,0000,0000,0000,,give you one example we can do something Dialogue: 0,0:33:37.56,0:33:46.32,Default,,0000,0000,0000,,like curl - -head --silent google.com Dialogue: 0,0:33:42.30,0:33:48.87,Default,,0000,0000,0000,,so just to show you what that looks Dialogue: 0,0:33:46.32,0:33:52.68,Default,,0000,0000,0000,,like this gives me all the HTTP headers Dialogue: 0,0:33:48.87,0:33:56.52,Default,,0000,0000,0000,,for accessing google.com and I can pipe Dialogue: 0,0:33:52.68,0:34:01.26,Default,,0000,0000,0000,,that to grep a - like a --ignore-case Dialogue: 0,0:33:56.52,0:34:04.23,Default,,0000,0000,0000,,or just -i if I want content Dialogue: 0,0:34:01.26,0:34:06.12,Default,,0000,0000,0000,,length so this is gonna print the Dialogue: 0,0:34:04.23,0:34:07.50,Default,,0000,0000,0000,,content length header, grep is a program Dialogue: 0,0:34:06.12,0:34:09.09,Default,,0000,0000,0000,,that we'll talk about later they'll let Dialogue: 0,0:34:07.50,0:34:12.66,Default,,0000,0000,0000,,you search in an input stream for a Dialogue: 0,0:34:09.09,0:34:15.56,Default,,0000,0000,0000,,given keyword we can pipe that through Dialogue: 0,0:34:12.66,0:34:20.19,Default,,0000,0000,0000,,say the cut command which takes a Dialogue: 0,0:34:15.56,0:34:22.26,Default,,0000,0000,0000,,delimiter set that to be space and I Dialogue: 0,0:34:20.19,0:34:24.42,Default,,0000,0000,0000,,want the second field and this prints Dialogue: 0,0:34:22.26,0:34:25.95,Default,,0000,0000,0000,,just the content length this is sort of Dialogue: 0,0:34:24.42,0:34:28.38,Default,,0000,0000,0000,,a silly example right like this just Dialogue: 0,0:34:25.95,0:34:30.18,Default,,0000,0000,0000,,lets you extract the content length in Dialogue: 0,0:34:28.38,0:34:32.70,Default,,0000,0000,0000,,bytes of google.com from the command Dialogue: 0,0:34:30.18,0:34:34.74,Default,,0000,0000,0000,,line it's not a very useful thing to do Dialogue: 0,0:34:32.70,0:34:36.30,Default,,0000,0000,0000,,but you can see how by chaining these Dialogue: 0,0:34:34.74,0:34:38.33,Default,,0000,0000,0000,,together you can achieve a bunch of Dialogue: 0,0:34:36.30,0:34:40.98,Default,,0000,0000,0000,,really interesting text manipulation Dialogue: 0,0:34:38.33,0:34:43.29,Default,,0000,0000,0000,,effects and it turns out pipes are not Dialogue: 0,0:34:40.98,0:34:45.33,Default,,0000,0000,0000,,just for textual data you can do this Dialogue: 0,0:34:43.29,0:34:47.85,Default,,0000,0000,0000,,for things like images as well you can Dialogue: 0,0:34:45.33,0:34:49.59,Default,,0000,0000,0000,,have a program that manipulates a binary Dialogue: 0,0:34:47.85,0:34:51.45,Default,,0000,0000,0000,,image on its input and writes a binary Dialogue: 0,0:34:49.59,0:34:53.40,Default,,0000,0000,0000,,image to its output and you can chain Dialogue: 0,0:34:51.45,0:34:54.84,Default,,0000,0000,0000,,them together in this way and we'll talk Dialogue: 0,0:34:53.40,0:34:57.00,Default,,0000,0000,0000,,about some of those kinds of examples Dialogue: 0,0:34:54.84,0:34:59.43,Default,,0000,0000,0000,,later on - you can even do this for Dialogue: 0,0:34:57.00,0:35:00.90,Default,,0000,0000,0000,,video if you want you can stream this is Dialogue: 0,0:34:59.43,0:35:02.94,Default,,0000,0000,0000,,for example a great way if you have a Dialogue: 0,0:35:00.90,0:35:05.79,Default,,0000,0000,0000,,chromecast at home you can stream a Dialogue: 0,0:35:02.94,0:35:07.92,Default,,0000,0000,0000,,video file like this by having the last Dialogue: 0,0:35:05.79,0:35:11.16,Default,,0000,0000,0000,,program in your pipe be a chromecast Dialogue: 0,0:35:07.92,0:35:13.05,Default,,0000,0000,0000,,send program so you stream a video file Dialogue: 0,0:35:11.16,0:35:19.14,Default,,0000,0000,0000,,into it and it streams or HTTP to your Dialogue: 0,0:35:13.05,0:35:20.37,Default,,0000,0000,0000,,chromecast we'll take we'll talk a lot Dialogue: 0,0:35:19.14,0:35:22.41,Default,,0000,0000,0000,,more about this in the data wrangling Dialogue: 0,0:35:20.37,0:35:25.11,Default,,0000,0000,0000,,lecture but there's one more thing that Dialogue: 0,0:35:22.41,0:35:27.80,Default,,0000,0000,0000,,I wanted to talk to you about about sort Dialogue: 0,0:35:25.11,0:35:30.39,Default,,0000,0000,0000,,of how to use the terminal and a more Dialogue: 0,0:35:27.80,0:35:31.92,Default,,0000,0000,0000,,interesting and perhaps more powerful Dialogue: 0,0:35:30.39,0:35:33.84,Default,,0000,0000,0000,,way that you might be used to and this Dialogue: 0,0:35:31.92,0:35:35.64,Default,,0000,0000,0000,,is perhaps even going to be interesting Dialogue: 0,0:35:33.84,0:35:37.72,Default,,0000,0000,0000,,for the ones of you who feel like you're Dialogue: 0,0:35:35.64,0:35:41.02,Default,,0000,0000,0000,,already comfortable with the term Dialogue: 0,0:35:37.72,0:35:43.03,Default,,0000,0000,0000,,but first we need to cover a important Dialogue: 0,0:35:41.02,0:35:44.89,Default,,0000,0000,0000,,topic when it comes to Linux systems and Dialogue: 0,0:35:43.03,0:35:47.62,Default,,0000,0000,0000,,Mac OS systems in particular which is Dialogue: 0,0:35:44.89,0:35:49.30,Default,,0000,0000,0000,,the notion of the root user the root Dialogue: 0,0:35:47.62,0:35:52.48,Default,,0000,0000,0000,,user is sort of like the administrator Dialogue: 0,0:35:49.30,0:35:55.00,Default,,0000,0000,0000,,user on Windows and it has user IDs zero Dialogue: 0,0:35:52.48,0:35:56.83,Default,,0000,0000,0000,,the root user is special because it is Dialogue: 0,0:35:55.00,0:35:59.68,Default,,0000,0000,0000,,allowed to do whatever it wants on your Dialogue: 0,0:35:56.83,0:36:01.54,Default,,0000,0000,0000,,system even if a file is like not Dialogue: 0,0:35:59.68,0:36:03.79,Default,,0000,0000,0000,,readable by anyone or if it's not Dialogue: 0,0:36:01.54,0:36:06.01,Default,,0000,0000,0000,,writable by anyone root can still access Dialogue: 0,0:36:03.79,0:36:09.00,Default,,0000,0000,0000,,that file root is sort of a super user Dialogue: 0,0:36:06.01,0:36:11.26,Default,,0000,0000,0000,,that gets to do whatever they want and Dialogue: 0,0:36:09.00,0:36:13.33,Default,,0000,0000,0000,,most of the time you will not be Dialogue: 0,0:36:11.26,0:36:15.55,Default,,0000,0000,0000,,operating as the super user you will not Dialogue: 0,0:36:13.33,0:36:17.35,Default,,0000,0000,0000,,be root you will be a user like John or Dialogue: 0,0:36:15.55,0:36:19.66,Default,,0000,0000,0000,,whatever your name is and that's going Dialogue: 0,0:36:17.35,0:36:21.37,Default,,0000,0000,0000,,to be the user you act with because if Dialogue: 0,0:36:19.66,0:36:23.47,Default,,0000,0000,0000,,you were operating your computer as the Dialogue: 0,0:36:21.37,0:36:24.70,Default,,0000,0000,0000,,root user at all times if you ran the Dialogue: 0,0:36:23.47,0:36:26.71,Default,,0000,0000,0000,,wrong program they could just completely Dialogue: 0,0:36:24.70,0:36:29.95,Default,,0000,0000,0000,,destroy your computer and you don't want Dialogue: 0,0:36:26.71,0:36:31.81,Default,,0000,0000,0000,,that right but every now and again you Dialogue: 0,0:36:29.95,0:36:34.45,Default,,0000,0000,0000,,want to do something that requires that Dialogue: 0,0:36:31.81,0:36:38.58,Default,,0000,0000,0000,,you are root usually for these cases you Dialogue: 0,0:36:34.45,0:36:42.79,Default,,0000,0000,0000,,will use a program called sudo su do or Dialogue: 0,0:36:38.58,0:36:44.74,Default,,0000,0000,0000,,do as su and su in this case is Super Dialogue: 0,0:36:42.79,0:36:46.59,Default,,0000,0000,0000,,User so this is a way to do the Dialogue: 0,0:36:44.74,0:36:49.75,Default,,0000,0000,0000,,following thing as the super user Dialogue: 0,0:36:46.59,0:36:51.49,Default,,0000,0000,0000,,usually the way sudo works is you write Dialogue: 0,0:36:49.75,0:36:53.02,Default,,0000,0000,0000,,sudo and then a command like you would Dialogue: 0,0:36:51.49,0:36:54.58,Default,,0000,0000,0000,,normally on your terminal and it will Dialogue: 0,0:36:53.02,0:36:56.23,Default,,0000,0000,0000,,just run that command as if you were Dialogue: 0,0:36:54.58,0:37:01.18,Default,,0000,0000,0000,,root as opposed to the user you actually Dialogue: 0,0:36:56.23,0:37:04.54,Default,,0000,0000,0000,,are where might you need something like Dialogue: 0,0:37:01.18,0:37:05.80,Default,,0000,0000,0000,,this well there is a special there are Dialogue: 0,0:37:04.54,0:37:07.51,Default,,0000,0000,0000,,many special file system on your Dialogue: 0,0:37:05.80,0:37:11.07,Default,,0000,0000,0000,,computer but in particular there's one Dialogue: 0,0:37:07.51,0:37:14.80,Default,,0000,0000,0000,,called sysfs if you CD to slash sys Dialogue: 0,0:37:11.07,0:37:17.32,Default,,0000,0000,0000,,this is a whole new world this file Dialogue: 0,0:37:14.80,0:37:19.72,Default,,0000,0000,0000,,system is are not actually files on your Dialogue: 0,0:37:17.32,0:37:22.12,Default,,0000,0000,0000,,computer instead these are various Dialogue: 0,0:37:19.72,0:37:24.18,Default,,0000,0000,0000,,kernel parameters so the kernel is like Dialogue: 0,0:37:22.12,0:37:26.68,Default,,0000,0000,0000,,basically the the core of your computer Dialogue: 0,0:37:24.18,0:37:29.56,Default,,0000,0000,0000,,this is a way for you to access various Dialogue: 0,0:37:26.68,0:37:32.68,Default,,0000,0000,0000,,kernel parameters through what looks Dialogue: 0,0:37:29.56,0:37:35.95,Default,,0000,0000,0000,,like a file system you'll see here that Dialogue: 0,0:37:32.68,0:37:37.69,Default,,0000,0000,0000,,if I CD into class for example it has Dialogue: 0,0:37:35.95,0:37:39.88,Default,,0000,0000,0000,,directories for a bunch of different Dialogue: 0,0:37:37.69,0:37:43.75,Default,,0000,0000,0000,,types of devices that I can interact Dialogue: 0,0:37:39.88,0:37:47.92,Default,,0000,0000,0000,,with or various queues I can access or all Dialogue: 0,0:37:43.75,0:37:49.99,Default,,0000,0000,0000,,sorts of weird knobs internally and Dialogue: 0,0:37:47.92,0:37:50.41,Default,,0000,0000,0000,,because they're exposed as files it means Dialogue: 0,0:37:50.41,0:37:54.28,Default,,0000,0000,0000,,we can also use all the tools have been Dialogue: 0,0:37:52.03,0:37:57.58,Default,,0000,0000,0000,,using so far in order to manipulate them Dialogue: 0,0:37:54.28,0:38:01.42,Default,,0000,0000,0000,,one example of this is if you go into Dialogue: 0,0:37:57.58,0:38:02.44,Default,,0000,0000,0000,,sys class backlight so this backlight Dialogue: 0,0:38:01.42,0:38:04.18,Default,,0000,0000,0000,,directly and lets you configure the Dialogue: 0,0:38:02.44,0:38:06.76,Default,,0000,0000,0000,,backlight on your laptop if you have one Dialogue: 0,0:38:04.18,0:38:08.92,Default,,0000,0000,0000,,so I can CD in to intel backlight this Dialogue: 0,0:38:06.76,0:38:10.99,Default,,0000,0000,0000,,is an Intel laptop inside here you'll Dialogue: 0,0:38:08.92,0:38:12.76,Default,,0000,0000,0000,,see there's a file called brightness and Dialogue: 0,0:38:10.99,0:38:16.09,Default,,0000,0000,0000,,I can cat the brightness this is the Dialogue: 0,0:38:12.76,0:38:18.88,Default,,0000,0000,0000,,current brightness of my screen but not Dialogue: 0,0:38:16.09,0:38:21.46,Default,,0000,0000,0000,,only that I can modify this too in order Dialogue: 0,0:38:18.88,0:38:23.74,Default,,0000,0000,0000,,to change the brightness of my screen so Dialogue: 0,0:38:21.46,0:38:25.75,Default,,0000,0000,0000,,you might think that I could do let's Dialogue: 0,0:38:23.74,0:38:26.80,Default,,0000,0000,0000,,see what the max brightness is here okay Dialogue: 0,0:38:25.75,0:38:29.59,Default,,0000,0000,0000,,so it's currently set to the max Dialogue: 0,0:38:26.80,0:38:32.32,Default,,0000,0000,0000,,brightness you might imagine that I Dialogue: 0,0:38:29.59,0:38:35.41,Default,,0000,0000,0000,,could do something like if I do echo Dialogue: 0,0:38:32.32,0:38:39.01,Default,,0000,0000,0000,,let's do half or something Dialogue: 0,0:38:35.41,0:38:38.01,Default,,0000,0000,0000,,echo 500 to brightness Dialogue: 0,0:38:38.01,0:38:39.01,Default,,0000,0000,0000,,if I do this it says Dialogue: 0,0:38:39.01,0:38:43.09,Default,,0000,0000,0000,,permission denied I'm not allowed to Dialogue: 0,0:38:40.84,0:38:45.22,Default,,0000,0000,0000,,modify brightness because in order to Dialogue: 0,0:38:43.09,0:38:46.60,Default,,0000,0000,0000,,basically in order to change things in Dialogue: 0,0:38:45.22,0:38:48.46,Default,,0000,0000,0000,,the kernel you need to be the Dialogue: 0,0:38:46.60,0:38:50.62,Default,,0000,0000,0000,,administrator and you might imagine that Dialogue: 0,0:38:48.46,0:38:52.96,Default,,0000,0000,0000,,the way to solve this is to write sudo Dialogue: 0,0:38:50.62,0:38:55.78,Default,,0000,0000,0000,,echo 500 but I still get a permission Dialogue: 0,0:38:52.96,0:38:58.26,Default,,0000,0000,0000,,denied error but why is that it's Dialogue: 0,0:38:55.78,0:39:00.55,Default,,0000,0000,0000,,because as I mentioned before these Dialogue: 0,0:38:58.26,0:39:03.07,Default,,0000,0000,0000,,redirections of input and output is not Dialogue: 0,0:39:00.55,0:39:05.47,Default,,0000,0000,0000,,something the programs know about when Dialogue: 0,0:39:03.07,0:39:07.24,Default,,0000,0000,0000,,we piped Elison to tail tail did not Dialogue: 0,0:39:05.47,0:39:09.61,Default,,0000,0000,0000,,know about LS and LS did not know about Dialogue: 0,0:39:07.24,0:39:11.86,Default,,0000,0000,0000,,tail the pipe and the redirection was Dialogue: 0,0:39:09.61,0:39:14.08,Default,,0000,0000,0000,,set up by the shell so in this case Dialogue: 0,0:39:11.86,0:39:18.04,Default,,0000,0000,0000,,what's happening is I'm telling my shell Dialogue: 0,0:39:14.08,0:39:21.22,Default,,0000,0000,0000,,run the program sudo with the arguments Dialogue: 0,0:39:18.04,0:39:24.13,Default,,0000,0000,0000,,echo and 500 and send its output to the Dialogue: 0,0:39:21.22,0:39:25.93,Default,,0000,0000,0000,,file called brightness but the shell is Dialogue: 0,0:39:24.13,0:39:29.41,Default,,0000,0000,0000,,what is opening the brightness file it Dialogue: 0,0:39:25.93,0:39:32.38,Default,,0000,0000,0000,,is not the sudo program so in this case Dialogue: 0,0:39:29.41,0:39:33.79,Default,,0000,0000,0000,,the shell which is running as me tries Dialogue: 0,0:39:32.38,0:39:35.47,Default,,0000,0000,0000,,to open the brightness file for writing Dialogue: 0,0:39:33.79,0:39:37.08,Default,,0000,0000,0000,,and it's not allowed to do that and Dialogue: 0,0:39:35.47,0:39:39.78,Default,,0000,0000,0000,,therefore I get a permission down error Dialogue: 0,0:39:37.08,0:39:42.34,Default,,0000,0000,0000,,you might have seen this if you like Dialogue: 0,0:39:39.78,0:39:43.75,Default,,0000,0000,0000,,search for something end up on Stack Dialogue: 0,0:39:42.34,0:39:45.40,Default,,0000,0000,0000,,Overflow and it tells just run this Dialogue: 0,0:39:43.75,0:39:47.44,Default,,0000,0000,0000,,command and you'll see that it does Dialogue: 0,0:39:45.40,0:39:52.93,Default,,0000,0000,0000,,something like they give you Dialogue: 0,0:39:47.44,0:39:57.97,Default,,0000,0000,0000,,instructions like one two sis what's an Dialogue: 0,0:39:52.93,0:39:59.56,Default,,0000,0000,0000,,example net ipv4 for word for example Dialogue: 0,0:39:57.97,0:40:02.59,Default,,0000,0000,0000,,this is something you may have seen if Dialogue: 0,0:39:59.56,0:40:04.24,Default,,0000,0000,0000,,you're setting up a firewall and this Dialogue: 0,0:40:02.59,0:40:05.68,Default,,0000,0000,0000,,command is intended to work Dialogue: 0,0:40:04.24,0:40:08.20,Default,,0000,0000,0000,,because this little pound symbol Dialogue: 0,0:40:05.68,0:40:09.64,Default,,0000,0000,0000,,indicates run this as root this is Dialogue: 0,0:40:08.20,0:40:11.17,Default,,0000,0000,0000,,something that is very rarely explained Dialogue: 0,0:40:09.64,0:40:12.97,Default,,0000,0000,0000,,but that is what the pound symbol means Dialogue: 0,0:40:11.17,0:40:15.10,Default,,0000,0000,0000,,you'll see on my prompt there's a dollar Dialogue: 0,0:40:12.97,0:40:17.71,Default,,0000,0000,0000,,symbol instead and the dollar indicates Dialogue: 0,0:40:15.10,0:40:18.82,Default,,0000,0000,0000,,you are not running as root so the Dialogue: 0,0:40:17.71,0:40:22.27,Default,,0000,0000,0000,,question is how do I get around this Dialogue: 0,0:40:18.82,0:40:24.69,Default,,0000,0000,0000,,well I could switch into a root terminal Dialogue: 0,0:40:22.27,0:40:27.37,Default,,0000,0000,0000,,so one way to do this is to run sudo su Dialogue: 0,0:40:24.69,0:40:32.14,Default,,0000,0000,0000,,sudo su is saying run the following Dialogue: 0,0:40:27.37,0:40:34.33,Default,,0000,0000,0000,,command s root and su is a complicated Dialogue: 0,0:40:32.14,0:40:37.29,Default,,0000,0000,0000,,command that effectively gets you a Dialogue: 0,0:40:34.33,0:40:40.60,Default,,0000,0000,0000,,shell as the super user so if I do this Dialogue: 0,0:40:37.29,0:40:42.01,Default,,0000,0000,0000,,type of password then now you'll see Dialogue: 0,0:40:40.60,0:40:44.53,Default,,0000,0000,0000,,that the username at the beginning Dialogue: 0,0:40:42.01,0:40:47.11,Default,,0000,0000,0000,,changed from jon to root and the prompt Dialogue: 0,0:40:44.53,0:40:49.39,Default,,0000,0000,0000,,changed from a dollar to a pound if I Dialogue: 0,0:40:47.11,0:40:52.24,Default,,0000,0000,0000,,now I come in to that file if I do echo Dialogue: 0,0:40:49.39,0:40:54.01,Default,,0000,0000,0000,,500 to brightness my screen got a little Dialogue: 0,0:40:52.24,0:40:57.04,Default,,0000,0000,0000,,dimmer but you can't see it you just Dialogue: 0,0:40:54.01,0:40:58.99,Default,,0000,0000,0000,,have to trust me and now I didn't get an Dialogue: 0,0:40:57.04,0:41:01.63,Default,,0000,0000,0000,,error and this is because the shell is Dialogue: 0,0:40:58.99,0:41:04.54,Default,,0000,0000,0000,,now running as root it is not running as Dialogue: 0,0:41:01.63,0:41:07.36,Default,,0000,0000,0000,,Jon and the root user is allowed to open Dialogue: 0,0:41:04.54,0:41:09.76,Default,,0000,0000,0000,,this file but given our knowledge that Dialogue: 0,0:41:07.36,0:41:11.35,Default,,0000,0000,0000,,we have of the terminal now there's Dialogue: 0,0:41:09.76,0:41:13.72,Default,,0000,0000,0000,,actually a way for us to do this without Dialogue: 0,0:41:11.35,0:41:19.12,Default,,0000,0000,0000,,having to drop to a root shell and that Dialogue: 0,0:41:13.72,0:41:22.99,Default,,0000,0000,0000,,is as follows that's I guess restore it Dialogue: 0,0:41:19.12,0:41:26.59,Default,,0000,0000,0000,,to 1060 so do you see why this is Dialogue: 0,0:41:22.99,0:41:29.02,Default,,0000,0000,0000,,different here I'm telling my shell to Dialogue: 0,0:41:26.59,0:41:31.27,Default,,0000,0000,0000,,run the echo 1060 command which is gonna Dialogue: 0,0:41:29.02,0:41:33.37,Default,,0000,0000,0000,,echo 1060 and I'm telling it to run the Dialogue: 0,0:41:31.27,0:41:35.89,Default,,0000,0000,0000,,sudo tee brightness command and I'm Dialogue: 0,0:41:33.37,0:41:39.16,Default,,0000,0000,0000,,telling you to send the output of echo Dialogue: 0,0:41:35.89,0:41:40.54,Default,,0000,0000,0000,,into sudo tee in order to understand this Dialogue: 0,0:41:39.16,0:41:43.45,Default,,0000,0000,0000,,you need to know what the tee command does Dialogue: 0,0:41:40.54,0:41:47.08,Default,,0000,0000,0000,,the tee command takes its input and writes Dialogue: 0,0:41:43.45,0:41:49.54,Default,,0000,0000,0000,,it to a file but also to standard out so Dialogue: 0,0:41:47.08,0:41:52.33,Default,,0000,0000,0000,,tee is a convenient way if you have say a Dialogue: 0,0:41:49.54,0:41:54.16,Default,,0000,0000,0000,,log file that you want to like send to a Dialogue: 0,0:41:52.33,0:41:56.23,Default,,0000,0000,0000,,file to store for later but you also Dialogue: 0,0:41:54.16,0:41:58.06,Default,,0000,0000,0000,,want to see it to yourself then you can Dialogue: 0,0:41:56.23,0:41:59.77,Default,,0000,0000,0000,,pipe it through tee give it the name of a Dialogue: 0,0:41:58.06,0:42:01.81,Default,,0000,0000,0000,,file and it will write whatever its Dialogue: 0,0:41:59.77,0:42:04.27,Default,,0000,0000,0000,,input is both to that file and to your Dialogue: 0,0:42:01.81,0:42:07.63,Default,,0000,0000,0000,,screen and here I'm taking advantage of Dialogue: 0,0:42:04.27,0:42:09.94,Default,,0000,0000,0000,,that program I'm saying run tee as route Dialogue: 0,0:42:07.63,0:42:12.97,Default,,0000,0000,0000,,and have tee right into the brightness Dialogue: 0,0:42:09.94,0:42:14.38,Default,,0000,0000,0000,,file and so in this case the tee program Dialogue: 0,0:42:12.97,0:42:16.15,Default,,0000,0000,0000,,which is what is opening the brightness Dialogue: 0,0:42:14.38,0:42:17.37,Default,,0000,0000,0000,,file is running as root and so it is Dialogue: 0,0:42:16.15,0:42:20.19,Default,,0000,0000,0000,,allowed to do Dialogue: 0,0:42:17.37,0:42:21.39,Default,,0000,0000,0000,,if I run this it will now again you Dialogue: 0,0:42:20.19,0:42:23.85,Default,,0000,0000,0000,,can't see but the brightness and I've Dialogue: 0,0:42:21.39,0:42:25.77,Default,,0000,0000,0000,,been turned on by a laptop and I don't Dialogue: 0,0:42:23.85,0:42:27.39,Default,,0000,0000,0000,,get any errors and I never had to drop Dialogue: 0,0:42:25.77,0:42:30.93,Default,,0000,0000,0000,,into a root shell and run commands there Dialogue: 0,0:42:27.39,0:42:32.16,Default,,0000,0000,0000,,which can often be somewhat dangerous if Dialogue: 0,0:42:30.93,0:42:33.45,Default,,0000,0000,0000,,you want to explore this filesystem a Dialogue: 0,0:42:32.16,0:42:35.94,Default,,0000,0000,0000,,little bit more there's a lot of Dialogue: 0,0:42:33.45,0:42:39.45,Default,,0000,0000,0000,,interesting stuff in here if you just Dialogue: 0,0:42:35.94,0:42:41.43,Default,,0000,0000,0000,,sort of start browsing around you can Dialogue: 0,0:42:39.45,0:42:42.93,Default,,0000,0000,0000,,find all sorts of fun things so for Dialogue: 0,0:42:41.43,0:42:45.09,Default,,0000,0000,0000,,example we noticed that there was a fun Dialogue: 0,0:42:42.93,0:42:48.54,Default,,0000,0000,0000,,brightness command here I wonder what Dialogue: 0,0:42:45.09,0:42:49.98,Default,,0000,0000,0000,,other kinds of brightness I can set so I Dialogue: 0,0:42:48.54,0:42:51.86,Default,,0000,0000,0000,,can use the find command which we will Dialogue: 0,0:42:49.98,0:42:56.00,Default,,0000,0000,0000,,also talk about in a coming lecture I Dialogue: 0,0:42:51.86,0:42:58.86,Default,,0000,0000,0000,,wouldn't look on any file whose name Dialogue: 0,0:42:56.00,0:43:01.89,Default,,0000,0000,0000,,it's a little like brightness in the Dialogue: 0,0:42:58.86,0:43:05.07,Default,,0000,0000,0000,,current directory that's unhelpful maybe Dialogue: 0,0:43:01.89,0:43:08.85,Default,,0000,0000,0000,,they're not files did I misspell Dialogue: 0,0:43:05.07,0:43:17.01,Default,,0000,0000,0000,,brightness yeah why is it being annoying Dialogue: 0,0:43:08.85,0:43:20.46,Default,,0000,0000,0000,,Oh apparently it does not want to search Dialogue: 0,0:43:17.01,0:43:23.91,Default,,0000,0000,0000,,for brightness for me how well luckily Dialogue: 0,0:43:20.46,0:43:27.48,Default,,0000,0000,0000,,for you I know of one already handy that Dialogue: 0,0:43:23.91,0:43:30.09,Default,,0000,0000,0000,,there is a subdirectory called LEDs and Dialogue: 0,0:43:27.48,0:43:32.40,Default,,0000,0000,0000,,LEDs have brightness too what kind of Dialogue: 0,0:43:30.09,0:43:36.96,Default,,0000,0000,0000,,LEDs are there ooh lots of things for Dialogue: 0,0:43:32.40,0:43:38.28,Default,,0000,0000,0000,,example the scroll lock led now most of Dialogue: 0,0:43:36.96,0:43:40.29,Default,,0000,0000,0000,,you probably don't know what the scroll Dialogue: 0,0:43:38.28,0:43:42.78,Default,,0000,0000,0000,,lock LED is or much less what scroll Dialogue: 0,0:43:40.29,0:43:45.77,Default,,0000,0000,0000,,lock is you might have seen a key on Dialogue: 0,0:43:42.78,0:43:47.67,Default,,0000,0000,0000,,your keyboard neighbor named scroll lock Dialogue: 0,0:43:45.77,0:43:49.65,Default,,0000,0000,0000,,basically no one knows what it means Dialogue: 0,0:43:47.67,0:43:51.75,Default,,0000,0000,0000,,anymore no one really uses it for Dialogue: 0,0:43:49.65,0:43:55.68,Default,,0000,0000,0000,,anything it's mostly just a dead key and Dialogue: 0,0:43:51.75,0:43:57.24,Default,,0000,0000,0000,,also a dead LED what if you wanted to Dialogue: 0,0:43:55.68,0:43:59.22,Default,,0000,0000,0000,,configure it so that every time you get Dialogue: 0,0:43:57.24,0:44:00.96,Default,,0000,0000,0000,,email your scroll lock LED lights up Dialogue: 0,0:43:59.22,0:44:03.27,Default,,0000,0000,0000,,because there's no other reason why it Dialogue: 0,0:44:00.96,0:44:06.00,Default,,0000,0000,0000,,would light up well if we seed you into Dialogue: 0,0:44:03.27,0:44:08.13,Default,,0000,0000,0000,,this particular directory that has a Dialogue: 0,0:44:06.00,0:44:12.32,Default,,0000,0000,0000,,brightness place and it's set to zero Dialogue: 0,0:44:08.13,0:44:12.32,Default,,0000,0000,0000,,well what happens if I write one into it Dialogue: 0,0:44:12.59,0:44:17.22,Default,,0000,0000,0000,,you probably should not just be writing Dialogue: 0,0:44:15.33,0:44:18.72,Default,,0000,0000,0000,,random numbers into random files in this Dialogue: 0,0:44:17.22,0:44:20.31,Default,,0000,0000,0000,,directory because you are affecting your Dialogue: 0,0:44:18.72,0:44:22.56,Default,,0000,0000,0000,,kernel directly like look up what the Dialogue: 0,0:44:20.31,0:44:24.24,Default,,0000,0000,0000,,files do in this particular case I have Dialogue: 0,0:44:22.56,0:44:28.05,Default,,0000,0000,0000,,warned safety goggles and I've done my Dialogue: 0,0:44:24.24,0:44:30.63,Default,,0000,0000,0000,,research so now you can't tell but on my Dialogue: 0,0:44:28.05,0:44:33.51,Default,,0000,0000,0000,,keyboard the scroll lock LED is now lit Dialogue: 0,0:44:30.63,0:44:35.40,Default,,0000,0000,0000,,so now if I wrote a program that like Dialogue: 0,0:44:33.51,0:44:37.83,Default,,0000,0000,0000,,did some checking of mail and stuff I Dialogue: 0,0:44:35.40,0:44:40.23,Default,,0000,0000,0000,,could have it at the end run a program Dialogue: 0,0:44:37.83,0:44:43.50,Default,,0000,0000,0000,,that echoes one into this file and now I Dialogue: 0,0:44:40.23,0:44:47.46,Default,,0000,0000,0000,,have a way for my led to my keyboard to Dialogue: 0,0:44:43.50,0:44:49.68,Default,,0000,0000,0000,,indicate when I've new email at this Dialogue: 0,0:44:47.46,0:44:50.94,Default,,0000,0000,0000,,point you should know roughly your way Dialogue: 0,0:44:49.68,0:44:54.27,Default,,0000,0000,0000,,around Dialogue: 0,0:44:50.94,0:44:56.25,Default,,0000,0000,0000,,the terminal around the shell and and Dialogue: 0,0:44:54.27,0:44:58.92,Default,,0000,0000,0000,,know enough to accomplish these basic Dialogue: 0,0:44:56.25,0:45:01.29,Default,,0000,0000,0000,,tasks at least in theory now you Dialogue: 0,0:44:58.92,0:45:02.82,Default,,0000,0000,0000,,shouldn't need to use like Dialogue: 0,0:45:01.29,0:45:03.42,Default,,0000,0000,0000,,point-and-click interfaces to find files Dialogue: 0,0:45:02.82,0:45:05.28,Default,,0000,0000,0000,,anymore Dialogue: 0,0:45:03.42,0:45:07.47,Default,,0000,0000,0000,,there's one remaining trick you might Dialogue: 0,0:45:05.28,0:45:10.53,Default,,0000,0000,0000,,need and that is the ability to open a Dialogue: 0,0:45:07.47,0:45:13.95,Default,,0000,0000,0000,,file so far I've only really given you Dialogue: 0,0:45:10.53,0:45:17.69,Default,,0000,0000,0000,,ways to find files but one thing you Dialogue: 0,0:45:13.95,0:45:21.42,Default,,0000,0000,0000,,should know about is missing semester Dialogue: 0,0:45:17.69,0:45:23.64,Default,,0000,0000,0000,,xdg-open this will probably only work Dialogue: 0,0:45:21.42,0:45:27.12,Default,,0000,0000,0000,,on Linux on Mac OS I think it's just Dialogue: 0,0:45:23.64,0:45:29.43,Default,,0000,0000,0000,,called open on Windows who knows Dialogue: 0,0:45:27.12,0:45:31.74,Default,,0000,0000,0000,,xdg-open you give the name of a file and Dialogue: 0,0:45:29.43,0:45:34.77,Default,,0000,0000,0000,,it will open it in the appropriate program Dialogue: 0,0:45:31.74,0:45:36.18,Default,,0000,0000,0000,,so if you open if you do xdg-open an Dialogue: 0,0:45:34.77,0:45:39.27,Default,,0000,0000,0000,,HTML file that will open your browser Dialogue: 0,0:45:36.18,0:45:41.04,Default,,0000,0000,0000,,and open that file and once you have Dialogue: 0,0:45:39.27,0:45:42.87,Default,,0000,0000,0000,,that program in theory you should no Dialogue: 0,0:45:41.04,0:45:45.06,Default,,0000,0000,0000,,longer need to open like a Finder window Dialogue: 0,0:45:42.87,0:45:46.80,Default,,0000,0000,0000,,ever again you might want to for other Dialogue: 0,0:45:45.06,0:45:48.18,Default,,0000,0000,0000,,reasons but in theory you can accomplish Dialogue: 0,0:45:46.80,0:45:50.79,Default,,0000,0000,0000,,at all using the tools that we've Dialogue: 0,0:45:48.18,0:45:53.85,Default,,0000,0000,0000,,learned today this might all seem Dialogue: 0,0:45:50.79,0:45:55.59,Default,,0000,0000,0000,,relatively basic for some of you but as Dialogue: 0,0:45:53.85,0:45:57.48,Default,,0000,0000,0000,,I mentioned this is sort of the ramp-up Dialogue: 0,0:45:55.59,0:45:59.46,Default,,0000,0000,0000,,period of now we all know how the shell Dialogue: 0,0:45:57.48,0:46:01.98,Default,,0000,0000,0000,,works and a lot of what we'll be doing Dialogue: 0,0:45:59.46,0:46:03.45,Default,,0000,0000,0000,,in future lectures is using this Dialogue: 0,0:46:01.98,0:46:07.02,Default,,0000,0000,0000,,knowledge to do really interesting Dialogue: 0,0:46:03.45,0:46:09.45,Default,,0000,0000,0000,,things using the shell that sort of this Dialogue: 0,0:46:07.02,0:46:10.98,Default,,0000,0000,0000,,is learning the the interface that we're Dialogue: 0,0:46:09.45,0:46:14.85,Default,,0000,0000,0000,,going to be using and so it's important Dialogue: 0,0:46:10.98,0:46:16.65,Default,,0000,0000,0000,,we all know it we're gonna talk a lot Dialogue: 0,0:46:14.85,0:46:18.27,Default,,0000,0000,0000,,more in the next lecture about how to Dialogue: 0,0:46:16.65,0:46:20.31,Default,,0000,0000,0000,,automate tasks like this how to write Dialogue: 0,0:46:18.27,0:46:22.14,Default,,0000,0000,0000,,scripts that run a bunch of programs for Dialogue: 0,0:46:20.31,0:46:24.39,Default,,0000,0000,0000,,you and have to do things like Dialogue: 0,0:46:22.14,0:46:26.70,Default,,0000,0000,0000,,conditionals and loops and stuff in your Dialogue: 0,0:46:24.39,0:46:29.01,Default,,0000,0000,0000,,terminal and do things like run a Dialogue: 0,0:46:26.70,0:46:30.39,Default,,0000,0000,0000,,program until it fails which can be Dialogue: 0,0:46:29.01,0:46:31.98,Default,,0000,0000,0000,,handy in classes where you want to run Dialogue: 0,0:46:30.39,0:46:35.37,Default,,0000,0000,0000,,something until your test suite fails Dialogue: 0,0:46:31.98,0:46:38.55,Default,,0000,0000,0000,,for example so that's the topic for next Dialogue: 0,0:46:35.37,0:46:39.90,Default,,0000,0000,0000,,week's lecture did you have a question Dialogue: 0,0:46:38.55,0:46:42.42,Default,,0000,0000,0000,,it's what you've been demoing this Dialogue: 0,0:46:39.90,0:46:49.77,Default,,0000,0000,0000,,assist directory that presumably will Dialogue: 0,0:46:42.42,0:46:52.53,Default,,0000,0000,0000,,only work if you're running that is a Dialogue: 0,0:46:49.77,0:46:55.44,Default,,0000,0000,0000,,good question I don't know whether the Dialogue: 0,0:46:52.53,0:46:57.57,Default,,0000,0000,0000,,windows subsystem for Linux will expose Dialogue: 0,0:46:55.44,0:46:59.28,Default,,0000,0000,0000,,the sis file system if it does it Dialogue: 0,0:46:57.57,0:47:03.18,Default,,0000,0000,0000,,probably only exposes a very small Dialogue: 0,0:46:59.28,0:47:08.49,Default,,0000,0000,0000,,number of things it might because there Dialogue: 0,0:47:03.18,0:47:10.32,Default,,0000,0000,0000,,are I don't know check it out Dialogue: 0,0:47:08.49,0:47:11.61,Default,,0000,0000,0000,,one thing you'll see is the lecture Dialogue: 0,0:47:10.32,0:47:14.37,Default,,0000,0000,0000,,notes for this lecture are already Dialogue: 0,0:47:11.61,0:47:16.77,Default,,0000,0000,0000,,online and at the very bottom of the Dialogue: 0,0:47:14.37,0:47:18.42,Default,,0000,0000,0000,,file there are a bunch of exercises some Dialogue: 0,0:47:16.77,0:47:20.19,Default,,0000,0000,0000,,of them are relatively easy some of them Dialogue: 0,0:47:18.42,0:47:22.56,Default,,0000,0000,0000,,are a little bit harder and what we Dialogue: 0,0:47:20.19,0:47:24.06,Default,,0000,0000,0000,,encourage you to do is to take a stab at Dialogue: 0,0:47:22.56,0:47:25.41,Default,,0000,0000,0000,,going through them if you know this Dialogue: 0,0:47:24.06,0:47:27.66,Default,,0000,0000,0000,,stuff already it should go really Dialogue: 0,0:47:25.41,0:47:29.40,Default,,0000,0000,0000,,quickly if you don't it might teach you Dialogue: 0,0:47:27.66,0:47:31.74,Default,,0000,0000,0000,,a bunch of things that you might not Dialogue: 0,0:47:29.40,0:47:33.15,Default,,0000,0000,0000,,realize you didn't know and for the Dialogue: 0,0:47:31.74,0:47:35.19,Default,,0000,0000,0000,,office hours that we're gonna do right Dialogue: 0,0:47:33.15,0:47:36.84,Default,,0000,0000,0000,,after this lecture we will happily help Dialogue: 0,0:47:35.19,0:47:38.16,Default,,0000,0000,0000,,you get through all of those or if there Dialogue: 0,0:47:36.84,0:47:39.54,Default,,0000,0000,0000,,are other commands and you learn in the Dialogue: 0,0:47:38.16,0:47:42.30,Default,,0000,0000,0000,,process you want to know how to use more Dialogue: 0,0:47:39.54,0:47:44.91,Default,,0000,0000,0000,,efficiently and then in next lecture Dialogue: 0,0:47:42.30,0:47:46.71,Default,,0000,0000,0000,,which is tomorrow will basically be Dialogue: 0,0:47:44.91,0:47:48.29,Default,,0000,0000,0000,,assuming that you know the kind of stuff Dialogue: 0,0:47:46.71,0:47:51.75,Default,,0000,0000,0000,,that the exercise is going to teach you Dialogue: 0,0:47:48.29,0:47:53.03,Default,,0000,0000,0000,,there's also a an email address on the Dialogue: 0,0:47:51.75,0:47:56.10,Default,,0000,0000,0000,,website where you can send us questions Dialogue: 0,0:47:53.03,0:47:58.86,Default,,0000,0000,0000,,if you think of something like after the Dialogue: 0,0:47:56.10,0:48:05.16,Default,,0000,0000,0000,,office hours are finished are there any Dialogue: 0,0:47:58.86,0:48:07.05,Default,,0000,0000,0000,,questions before we end today no no all Dialogue: 0,0:48:05.16,0:48:09.48,Default,,0000,0000,0000,,right well we will have office hours on Dialogue: 0,0:48:07.05,0:48:12.15,Default,,0000,0000,0000,,the ninth floor of the gates building of Dialogue: 0,0:48:09.48,0:48:15.83,Default,,0000,0000,0000,,building 32 in like five minutes Dialogue: 0,0:48:12.15,0:48:15.83,Default,,0000,0000,0000,,sweet see you there