LINUX COMMANDS TUTORIAL - CS50 on Twitch, EP. 13
Skills:
Linux & CLI80%
Key Takeaways
Explains Linux commands and their usage in a command prompt, covering topics like shell, terminal, and bash
Full Transcript
this is cs50 on twitch hello everybody my name is Colton agha today I am joined by Nick my name is Nick hello Nick was here with us last week was it last week yeah Wow that was last Tuesday feels for some reason it feels like it was a long time I get out last week and we went through so we walked through machine learning at least the basics of machine learning using Karras and tensorflow and some OpenCV there's a lot of fun yeah we basic ml today though we're gonna take a step back away from the complexity of that dive into yeah so we're gonna talk about the mysterious Linux styled shell or UNIX shell or bash in particular oh yes I do actually have a version of a shell up right now people talk about shell terminal console bash linux shell command prompts has kind of all the same term they all mean slightly different things but generally speaking that's kind of their ideas they mean this they probably means something a little bit closer to like running actual commands like this or you can there's all sorts of stuff they're going to go through and talk about but generally that's when you see in like a movie there's like the hacker person going like click and clack and they've got a bunch of stuff going on the screen and then they're in that one website yes that is a great website actually and let's go find that hacker type yes it was in today in lecture during the actually had actually used it that's kind of Awesome it always say the Wi-Fi gotta love life always though I find yeah that's okay well basically a website lets you pretend like you're a hacker and let you type away we got a few people in the chat let's catch up on that yeah there's a bunch of people so shout out to everybody that was in your early so Babic night good to see you you know first sunlight and frost cakes frost cakes is a new person I'm not sure I have I've seen frost cake in here so welcome welcome to cs50 on twitch Bela cures abjad qzz one is new as well and we briefly chatted so thank you for joining us as Leigh is in the chat we have tux man 29 this is pseudo echo let's make some commands and we did actually run a version of that I didn't use sudo but we did echo let's make some commands big fan administrative permissions Bab ignite RM dash RF star dot star also in emoji I think but that would also remove everything don't type that command that's enough way uh-huh Andre from the Facebook as always good to have you with us Andre I see like to live dangerously this text mandates command there bill accuses hello Nick hello text man hey Colton hey Nick hey Tex man good to see you Babic night how's your day going days going how's your day going fantastic it's uh over here we actually have a huge celebration for this weekend because it's harvard-yale so that other school that lives somewhere in the rest of this country is coming here to play us in football and I actually don't watch any other football games the entire year except this one so everyone yeah you have to get like the whole school goes Gail's gonna be there we got to make sure that they know that we care they kind of have won the past two years is like I showed up to college and they started winning like super long we gotta bring that back yeah major fun hi everyone a mage good to see you again regex the cryptic language of Forgotten deities yes that sounds about right and on Tuesday David J mail is gonna talk to us about regex is actually that's also more of a thorough introduction to that I'm not sure if it's johor a one and A or if it's Johan a oh yeah maybe oh hi hey not sure mmm glad to have you with hello let me know how to pronounce your name so I'm pronouncing it correctly and then blue booger it's been a couple of times I do remember blue booger delete something in the chat good luck Harvard's thank you we appreciate it yeah hopefully we break our losing streak Linux no although if you were to try and type a lot of these things on like a PowerShell they kind of work in concept but you'd have to kind of dig around in some Duxford like specifics with the windows subsystem for linux yeah oh yeah they have bash on a boon to on windows yeah well there's kind of some limitations it's not quite like yeah it's kind of weird get it pretty right though yeah so it's like a useful thing you can definitely follow along using that on this if you know docker we will probably host a tutorial on that future that's coming but you're welcome to use a docker machine and I just spun up like in a boon to docker container which is what this is so yeah there's all sorts of ways to do this but I will be working in batch roots of the actual shell that we're gonna be using and there's something you could do on Linux you do this on like obviously you're on a Mac yep anything unix-style system is pretty readily available I think Mac by default gives you bash as a shell it's a really common shell it's super useful like it's one of the most versatile shells I think some of their common ones are like Z shell which is literally zsh and if you ever want to like test out some new shells you can always just type the name of the shell and that'll bring you into that shell I apparently tried CMS with it oh that is the prompt changed entirely I don't remember writing that but I guess I did yeah I think they're the color escape codes for prompt and I guess Z shell doesn't care and then you can type exit to get out of those shells SH is literally just a shell on shockingly and that actually just does nothing but it did actually move me into the shell there's bash there's another one that I'm gonna pub it but I won't actually use cuz it's kind of its own thing it's called fish super cool I'm a huge fan of fish it does it's super customizable it does all sorts of things the prompt is really beautiful - currently not but like that's ok fish does all sorts of just like beautiful autocomplete stuff so if I wanted to like cat a thing it'll autosuggest all sorts of stuff for me and I just tap complete that or list things out it's very very well designed I'm a huge fan but we're going to stick with bash for some kind of old old-fashioned ways are doing let's see we think we're doing this a few few ministers here so oh yeah Harvard for the wins is Matt McKnight Christianity lens foot aguar oh hi everybody hi Linda will be with us again Johanna is fine job our Johanna because I wanna make sure we get this right well wsl is open here just in case as Babic Babic I miss amis on a Windows system then yeah blue Berger docker isn't a brand of clothes is it is it actually really I think it's awesome yeah I'm not super fashionable or into clothing I am wearing a tech t-shirt but like yeah it also might be a brand of clothing we are in reference to the containerization system which is a little bit different although I guess in concepts they both hold things just silly but you've been attacked or it's late in my Meridian so I'm just passing by one I wish you a good fun stream thank you so much it thank you be on YouTube later so you can watch it in all of its glory when it's fully uploaded and post a comment you'll let us know enjoy for an extreme fashion show coming up you're gonna hope hey yeah yeah I'm super tech tech gear fashion show haha am I crazy to remember a show that uses sea as prompts oh so I think what you're thinking of is the like Windows command prompt which uses like C colon slash slash which is technically a shell I believe I'm not super familiar with it I try and avoid it at all costs I think it's super fun elegant elegant to use it's a pain I'm not a huge fan yes and then CD I think doesn't do it it does in bad it's like super annoying if you switch between them yeah doctors having a problem in the WS Ltd mendacious oh you might not depending on how wsl is configured you may not have like permissions to set up docker containers because they require some kind of hardware level access I've had daemon issues before not on Mac but on Ubuntu container or a boon to like machines that run docker and on those I think I solved it just by you giving it sudo access not it not the most elegant solution um definitely not something I would recommend but I know it does work it's really not a good like first try and if you're wondering what sudo is or what we mean by like access or things like that then that's exactly what we're going to talk about so yeah so it's awesome we love the back-and-forth and it's one of the best parts yeah and so in true stream style we actually basically just have nothing prepared and we're gonna walk through nothing but very very little like actual things written down that we've prepared but we do have kind of a general idea where we're going and outline a flow yeah exactly and I think I really like that actually it's really fun to kind of just walk through as we go and have it be a little bit fluid yeah if somebody suggests something was cool we could like going oh we can definitely go into it alright so - which is basically what I have open now if you wanted to like alright I should explain Blotz well start from the very beginning how about so if you're on a Mac how do you actually open it I guess then right that is a great question so if you're on a Mac you can use the spotlight search up in the top right and then just type in term and it'll bring up terminal and then pressing enter will bring me to my terminal alternatively if you go into Launchpad and search for turnip okay or not do you know those things and search for a terminal it will also come up and generally on any machine like if you have like your Mac or if you're on a some sort of a boon to distro or something like that they usually have the ability to search for some terminal and so you can click that and mine will just bring me to the one that's already open but yours will open a new one if you have not done so already nice cool so once you're in a terminal of some sort if you want to follow on exactly what we are doing you can make sure that you're in bash by typing in bash and pressing enter that will switch your shell whatever you shall you started it out on it will switch it over to bash assuming that you have bash installed one of my favorite and I think undervalued commands is which and it tells you just which thing you're using but before that even becomes meaningful so it'll tell me this it tells me a path we should tell you a little bit about how the kind of UNIX style is organized so basically in UNIX you can a lot of people imagine it as some sort of tree I know some people who imagine it as like a tree going upwards some people imagine as a tree going downward doesn't really matter as long as you're consistent so I generally I think imagined it as kind of like a downward looking tree like kind of branches down because I refer to going up in direct and then down into a directory I think that makes a lot of sense for me but if that doesn't work for you no worries and so the way that this tree is routed is you have slash that is the beginning of the tree that's at the very top for me or at the very bottom if you think of it the other way and so slashes as high up as you can go it's just the like directory that contains all mostly it contains all as far as like user land is concerned which is great so if we wanted to get into that directory we use CD CD is actually a really powerful command if you want to go between directories it means change directory or it stands for and we can do CD slash and so what CD takes as an optional argument is a path it can be a relative path meaning like using kind of dot notation which we'll talk about in a sec or it can be an absolute path which means it starts with a slash and then writes out where we're actually trying to go and so you'll snow tiss in my prompt that's the thing to the left over here there's a bunch of information that I have displayed and you can add and customize that however you'd like I try to keep mine pretty minimal so it just says the host of my computer my username currently and then which directory I'm in and then I keep the dollar sign for kind of traditional sake and so what that does is it changed from this kind of tilled which means home to slash which is what we just discussed it's the uppermost directory I can't go any higher than this and every user has their own sort of home directory on the hard drive yes ideally you actually are not required to have a home directory but generally speaking most users will have a home directory and if I wanted to get back to that home directory I can actually just type CD enter and you'll notice I go right back and then there's another kind of useful part to CD which is CD - and that actually brings you back to whichever directory you were just in so if I go to some random directory on my Mac then I can do CD - to bring me back to whichever directory I just came from it's kind of a useful little trick and a lot of people don't know about it I just there's a lot of little tricks I'm very lazy Seidler and a lot of these tricks so that I can not do as much work smart yeah I'm from Germany Berlin so however you think you would say it in German how we imagined Johanna then in that case yeah yes so you know sue does actually what Bab ignite points out is that typing in sudo su would grant you root access particularly I'm like and I've been to distro and we'll talk about that in a sec we're kind of going to talk by example because I think a lot of these things are very difficult to discuss without contacts yeah they're hardly showing it visibly to and illustrate dad makes it a little bit easier to explain it was at CIL for him oh man it was at Yale for me actually I didn't know about to do that really I'm an intermediate level user that's awesome I'm glad I can help that's that's fantastic so we'll get into some cool cool tricks by the end so then the next kind of basic command that everyone knows or should is LS which basically stands for list and what that does is it prints out what your current directory contains in it with a caveat it prints out the things that are meant to be displayed to you in your current directory LS takes a bunch of options so in command line I guess jargon people will always say oh you can use flags or options to change kind of the way that commands work and in the UNIX paradigm this was to make things really flexible so if you have these kind of small units you have LS you have CD you know like all these kind of like very minimal commands and what the UNIX basically like grand idea was was take these make them really like flexible with what they can do and then make them pluggable into each other and we'll talk about that a lot basically around halfway through where when you can mix all these commands together you can do some really complex stuff with very minimal syntax and without having to rewrite code or commands it was a really cool idea and I'm a huge fan of it I think it's awesome just modular design universal truth it looks like the java sign says hello nice to see you yes nice to see you too hi cool mimic I am Alvin 15 years old from Bergenfield New Jersey I will tune in to learn more about game development it's also nice to have Alvin I should say nice to have you on we should have a game dev one well yeah probably within a couple weeks or so gonna be it's a busy time parasya Sookie just ended we had our last lecture today yeah we have we have Thanksgiving next weekend then after that is that yeah oh maybe a week after that like you get an extra week between Thanksgiving I think you're right maybe so yeah it's gonna be a busy couple of weeks but well we'll have a ton of gamedev stuff in the future super happy to have you thanks for joining in yeah all right so we have Ellis and I just said that there is a small caveat to that so we're actually going to do LS - hey and you actually this this kind of joke amongst like kind of scripters or shell devs that the way people type ls' tells you a lot about like who taught them so hopefully you all will start to kind of do it the way I do it which is LS - al H is my favorite command as far as OS goes and it basically stands for a is for all Ella's for long H is for human readable on any sort of number and so what that prints out is this it's technically the same output as this in concept but it gives me a lot more information and so I also do a lot of work in cybersecurity I run the cyber club here and we basically end up that's why we get into this habit is because like a lot of the flags or things in our competitions are hidden in kind of these like very clear like obvious ways to find them and no one sees them because they're just not in this habit that I think would be very cool and I may be coming up Linux commands are always useful when diving into dev stuff this is also very true blueburger will be covering shell programming here scripts for loops oh I'm guessing he's thinking like a PI like bash scripting yeah so we will definitely talk a little bit about that especially because it's really useful to like automate a bunch of tasks really quickly and they're kind of useful to just know off the top of your head ironically I'm positive I will miss a bunch of syntax when we go to that section really so I why I need to brush up on that oh yeah no there's subaru there were all streams of game dev ashley ashley is generous they providing Alvin with some appreciate it alright so this output it looks like a lot and it is but it's definitely breakable or break down a bowl so this section here is I think fairly easy to understand it makes a lot of sense if you're just used to using a it's the last date that a file was touched and so the reason that I specified touched instead of like opened is there are a lot of ways of like manipulating files that actually don't open them so this is supposedly the last date it's supposed to be the last date or a time that a file was actually like interacted with and we'll leave that kind of vague for now and then here's the actual file name you'll see dot and dot dot in every directory on bash dot dot means the directory above dot is the current directory and so sometimes people will refer to things as using those sorts of paths and those are called relative paths so if I say dot slash that's going to be in the current directory slash is going to just separate paths filled or names basically and then going down from there if I do dot dot slash then that's in the previous directory in the higher directory from me and then we're gonna deal with something in there and we'll give some examples of that in a second for sunlight says helical Nick Rabin everyone hate from sunlight dates for drogas if I'm not mistaken I believe you said your name was was it Nate in a prior Shaima forgive me correct I I thought that that was what you said your name was right what a memory yeah coffee three to nine six is hi all and actually Dan coffee taught me how to use LS la that was so nice sure about LS that was how I used to that's okay yeah well yeah it's actually it's really funny that people have all these just different flags that they pass to LS ah web stream yes sorry my bad my bad okay that's fun my family is on the Facebook group there I saw the message that she posted earlier she was a pumping it - I think her school district or some phone calls that's awesome so thanks so much for for doing that fat month I will remember that whip streak was made so thank you guys that's awesome for Clarence clarifying that Dan comes is LS dash L right that is one of my favorite flags I use the H to make it so that these sizes of files so this is actually the file size right here are human readable so they use like BG and K instead of just random it's not random it looks like this and they try to give it to you and I believe bytes so I just don't like that one as much and then over on the left here is a bunch of permissions stuff so d basically stands for actually don't entirely remember what D stands for my apologies but if you look at the next set of nine letters those are very useful to know and they're very useful to understand why you can and cannot do certain things so route generally is going to have read write and execute access that's basically what the you stand for read or R is for reading can I read the file or directory' w write is can I write to it and then execute is whether or not I'm allowed to execute that on this computer root or sudo is generally allowed to do all three and actually the super users can change permissions at will so it wouldn't really necessarily matter no you're all good let's see so for suddenly out because if we were talking about previously about hmm that being five oh she said she had one of her students I guess she plugged it in her school district oh that's awesome so she plug the stream so Wow thank you your students are watching we appreciate all right Samantha wait ah right Stanford directory thank you I appreciate it that's what this D is for it actually just tells you that it's a directory very nice that therm oh no them are Mr Mr Mr Mr Mr Mr that's a good good deal so it says hello gents how are you this fine this fine evening I'm struggling to read I I really feel we were doing a fantastic or at least I'm doing fantastic yeah yeah huge hat and then the JA song says hey Colton what languages are you comfortable with what language are you comfortable pretty much most contemporary languages I've used at one point or another and they're all they all kind of blend together when you learn yeah it's a really paradigm-shifting ones that are kind of tricky like when you get right list program and stuff like that land that can be a little bit tricky but Java JavaScript Python C C++ Lua most of most common languages I would say yeah sounds about right bobak night and Irene Irene nyah it ain't a Sochi very cool both helped me out in saying yes for directory thank you tux man says he'll changes alias very nice the human readable part two LS is very useful oh and hello hey ain't it good to see you and are we doing live tutorials on this channel by the mister mister oh yeah yes basically yeah I do game development from scratch it's more like a build something from scratch typically we do have like today is more of a tutorial is a ssin right it kind of varies cream and I do tutorials as well yeah and then new Honda points out blue is so different hates Lua you'd speak in a tube you just taught a class an ich helped teach my games course but even we both use Lua for that and I know I enjoy like I'm shortcomings it reminds me of a bash scripting because and your stuff like right that is a very strange I mean I understand it but yeah that's weird like Python can you can get away with it yes significant whitespace it's kind of nice the worst so though in Python not to I guess go on too much of a tangent but in Python when you accidentally use space spaces and tabs and consistently and it calls you out for it it doesn't let you compile the code and so that's very you know I think it's I think it's kind of a blessing for especially when dealing with people that are new to programming into I have like that's your style right I think it's such a helpful thing to actually have like a consistent standard at which the compiler is literally enforcing it was a very good point helps kind of force you into styling correctly good stuff and honestly we need better styling in industry so alright awesome mr. oh thank you so much appreciate it appreciate it [Music] system gave me a headache yeah it's a little bit you have to be careful that's the only thing yeah it's like the inverse of Python or yes specify that a variable yeah it can probably no JavaScript I think where it's just kind of like you're like willy-nilly scoping and you're like over the moon for Lua it's because it's a reference to Lua being the Portuguese word for moon appreciate that's awesome mr. mr. Oh will you guys help me improve my understanding of C++ um so we don't have anything lined up yet for C++ it's possible that in the future we may do a tutorial on C++ but I'll have to give some thought to that because I haven't coded in it in a game development context before I just haven't haven't done it recently and it's kind of a it can be tough to neo life sometimes because yes yeah memory management can be a little bit yeah well maybe we'll have a tutorial on memory management yeah I know you like a low-level cease I am a huge fan of oh yeah actually one of the courses I mean right now switched over to C++ for great transition problem C which course is 61 so it's basically like low-level systems design interesting okay very cool didn't realize that's pretty cool yeah my cs50x final project was actually a small game that played in a virtual computer in Minecraft that uses Lua should be was it the computer craft I think it sounds like it yeah it does sound like it or I think it was also red power used Lua scripting I forget I forget what 29 that's awesome though job on that nice what the L stands for an L a long form so instead of printing out the kind of short and abbreviated version it just prints everything out on one line each and they're in a very lengthy format very nice question that I realize thanks to Dan coffee Mike has been me to the whole time so hopefully I've been able to hear me okay I've been speaking loud enough I apologize for that I should sound a lot better now Java song any game dev soon probably in about a week or so the next week is gonna be a little light it's Thanksgiving break and then after that we'll probably do a game dev a game dev stream yeah henna lar of this is the first time we've seen he'll our so thanks for joining us says nice as Li says cool I'm John q ZZ can you guys keep moving forward to specialize some specific time for comments sorry we're getting so many yeah it's a very good a very good point we will do so yes all right so we have LS things we've listed out what's going on here and generally LS works pretty well a very common paradigm is you'll see people traversing directories doing this like they might go CD library LS and then they'll do CD like logs LS and you kind of see this like CB OS CD OS which is very entertaining to give an example of how to go back up those dreck I can go back up both of them at once by doing dot slash dot dot which means go into the directory that is two above ours which is currently where we are now and basically when I refer to most Linux things or most like terminal style stuff I'm going to use terminology like we are currently in something that's just I guess a very common paradigm for ten users of Linux style thing it's got like the state of your shell right it means the state of where I am in shell what my shell has access to at the moment I saw the mr. mr. Oh says why why is the Linux terminals so intimidating and hopefully it'll be a little less than too many thing after that's because it isn't necessarily inherently terrible I think people just it has a lot of jargon to it and there's a lot of kind of just people seem to like just know things and that can be really really weird and it's not necessarily understood as to like how did they get there how do I know CV data and things like that and I think a lot of people just kind of learn it by example and I think the interface to is kind of kind of disparate or not disparate but it's kind of so separate from the gooeys that were just used to like with our all the devices use a daily basis like obviously terminals were super ubiquitous back in like the 80s and there is even but like now today is a good how are you is great for everything so it looks kind of arcane for I think most people when they first see it and it's kind of cool once you actually start getting really familiar with it and using it for a lot of things I use it to open up apps and stuff because I think it's faster I don't know if that's actually true I just feel faster doing it so I think a lot of people look at my flat top and then it kind of confused and actually I was that Lince put Aguada it talks about the tab Auto completion feature and that's a great feature that people often forget about or don't know about if you start typing let's see if I can find something that has multiple yeah you if you start typing something like if I wanted to CD into a you directory I can actually tap the tab and it'll try and autocomplete it however it can only autocomplete up to the information it knows and there are two directories in here user information and users that both start with you so what I can do is double tap tab and it'll list out the options for me and I can then pick between them I might say wax space and sorry whack is backslash I determine I just learned today yeah what I serve it working with a lot of the cybertek people they always will say things like oh do this whack whack this whack and you're just kind of like oh right that and I kind of just got used to it and now it will autocomplete the rest of that directory and I can press enter and now I'm in that directory spaces are kind of annoying in bash if you like most people try not to name things with spaces because it's kind of annoying to type that whack space because you have to tell bash to not exclude that space from the actual like name of the thing another way to do that is to wrap it in quotes that also does loose ApS night it says hi I'm Aman from India join me for the first time thank you so much for joining him on glad to have you with us sweet oh and just wrist we researched a little bit about Lewis name it comes from or after Sol simple object language as a joke since Sol is Sun in Portuguese and Lua is moon in Portuguese and now I have to like Lua for the wordplay exactly now you're in now it's a great gotta love CS humor um C was invented on a machine with 10 kilobytes of RAM that I didn't know I wouldn't be surprised yeah it kind of makes sense why they were so obsessed with memory things what do we think about the hacks from mr. robot how accurate are they so mr. robot does all sorts of cool things on like cyber tech challenges and cybersecurity things I'm a huge fan so generally I think they're pretty accurate he does all sorts of cool work on projects ranging from like the exploding bomb pset for example and all the way to like the vulnerability I think disk image which was very cool very fun thing to go with and then Bob McKnight points out that yes space has to be escaped with a whack upper it's super annoying to make a Durer with a space I agree generally I use underscores instead or just don't use spaces camel casing and underscores are kind of two different paradigms and both I think are very valid cool so I'm gonna go back into my home directory and we're gonna talk a little bit about some other commands that might be really useful so we have C D we have LS c d is to change directories and it takes a directories name or just kind of where you want to go if I try to go into developer which is a directory from my previous directory but it is not in home directory this should fail and it says no such file or directory and that's kind of a pain but it's just because I didn't provide the right path so what I can do is add a slash and this will work totally fine and so that's a actual like of forgetting the name absolute path there you adding that slash as opposed to the previous one which assumes some sort of relative path right and I'm gonna go back I could have also just typed CD on its own and also some useful tricks that are related to terminals on a lot of systems but are not necessarily directly inherent parts to the terminal are the control commands so I'm a huge fan of using them because they can make my life a lot easier a lot faster but a lot of people don't know about them so let's say I was typing out some very long command this is totally valid so yes and I realized that I forgot to put a quote at the beginning and type echo so I can do ctrl a and I can then be at the beginning of my terminal and I can do just that now it's about I didn't know that it's a very useful we want I'm using your arrow keys so you can actually go up in order to access previous commands on most systems which is also super useful as a shortcut let's see thank you so I can go back up to this previous command I can use ctrl a to edit something here and maybe I wanted to echo echo or something absurd and then I realized that's a completely invalid command so I could just press ENTER and have it give me some sort of error but I can also control e to go to the end of the line and control u wipes the line for me and so I'm a huge fan of using kind of the control AE U and L to clear off my terminals this is very clearly very quickly show me how little I know about using the command line I'm a huge fan I suppose if I learned Chinese gonna join the dark army I'm not sure what that's a reference to do you happen to know I believe that's a reference to the group of hackers that kind of lives on the dark web okay ish if you can find I didn't know nothing about that I have to say that was only wait and get around without ripping his hairs off system in 29 says it was in English in French we start about P I'm assuming you propagate yes what the next thing we were about to talk about I think this is useful explained she'll calm sounds you super familiar sounds like it would explain the shell that's cool yeah I like it uh gnome terminal displays the full path before that dollar sign is there any way to set that in max terminal do you always need PWD yeah no you can totally set that and actually we'll talk about that right after we talk about PS or process because I'm a huge fan of customizing my actual prompt as well and Mac's totally allow you to do that oh yeah frame of reference okay nice frame of reference a PC with Windows and I'm wondering how to get a PC with Linux through a server PC with Linux OS without dual booting or installing it on my PC thank you basically a virtual machine would be a way of doing that VirtualBox is a great basically advisor for that it's free and totally open to download and then you could also use docker which is I definitely has a Windows port I believe or has a Windows download and that would allow you to spin up machines of kind of any operating any operating system on your computer they make that super easy right yeah use bit dad docker for Windows and then just get bit it's like yeah straight super easy so either one would totally work and neither require you to actually go through to offer our donker tutorial what hasn't come and I'm not sure when we've had but I think it was like after Thanksgiving yeah it's coming up if you're curious and thank you also for joining us yes appreciate it room X you can also use control R to search for previously used commands I'm a huge fan of the reverse search so ctrl R if you have a command that you know you typed a very long time ago and you wanted to go and find it but you don't want to press up arrow just go up one at a time you can do ctrl R and then start typing the command and it will bring up the closest match it tries to go to the nearest one in your history and basically my previous commands that had py in it is not Python it's actually me grabbing a lorem ipsum from bacon ipsum calm and pasting it into my clipboard so now if I do command V we get this nice which is a weirdly meat-filled lorem ipsum i don't know why that was my command but that's okay you know insight into it's very strange Shana G hello with the Bob Ross pixel Bob nice I'm wondering this we can learn loose OS is there any online website you can practice type in the terminal without installing Linux do you know yes there is I believe ripple comm has a terminal if you're actually this worked so this is the hacker hacker type though ice I can type Branson is actually typing right now this is him typing answering on which how skilled he is as a programmer C++ marketing you would be the richest man I'm so rich if I could type that quickly I'm accurate free super bug free that's awesome that's hacker type net they're pretty cool or hacker typer and then there's also ripple dot i t I believe and that allows you to do it or as suggested in the comments you can use Linux like bash on up into on Windows 10 or you can use a virtual machine you can use docker there's a bunch of ways that you could do it without actually loading it into the computer or at least without installing it cool Dao a lot of times they say this is very exciting let me see where do we catch up on sorry I said the dark army is a hacker group in mr. robot oh okay good enough dark very heavy to be honest definitely came for debate yeah because I think if you have multiple installations that use the same container they optimize their space right right yeah it's a there's some like very good use cases for docker and also the docker paradigm is certainly not to have a full machine running on a docker container although a lot of us use them for that that is actually not their intention intended use case they try to make it more of like kind of the Linux paradigm but for applications like full complete applications which is very cool hey that's nice a killer customized the terminal in Ubuntu they write about yeah Bertha Kumar hi like your life session so easy understand how you guys talk thanks I'm awesome Thank You / thank you so much I guess happy you think so birth come our double-oh-seven yep great great username when does install doctor today then ran out of memory many times I had to remove it sorry to hear about that that's unfortunate don't leave your show open just control our but will it control our is reverse search so I'm not exactly sure what you meant by that for some light in case he means he or she means maybe if you quit your terminal they think that controller will still work for we did before but that's not not entirely not that I know of so basically if you are I think possibly what you mean is like clearing out history so I can actually type history and I'll get a list of all the weather the past like thousand commands that I that's cool which is kind of neat there's some interesting ones in here it's been like waitress serving is doing some good stuff so ways waitress oh it just is a server for like serving websites and it happens to work with any WSGI applications so like django example actually I think I'm giving a talk that will talk about that on Monday seminars yeah seminar for like Django and how to kind of get that up and tinted for that it seems to be seminar Monday with nip haha Django and whiskey applications yeah uh but uh you can just use a latex Fashion Show I get yep I was always told RM dash RF slash is a fun times a Slater USA there that's a that's funny definitely type that I'm back although we will destroy a Linux container read that way Detroit we had some troll faces in the chat for that one okay how did you pipe the output of your curl command to your paste clip yeah so piping is also a super cool feature of like the kind of UNIX paradigm or the Linux paradigm and basically what it does is let's say I want to type in some random gibberish a pipe or a vertical bar basically takes the output of that thing and sticks it into the input of the next thing and it's one of the greatest inventions I think of all of Linux I think yeah piping like chain programs together right and that's why everything can be so modular so kind of lightweight you're not reusing things and it's also a lot easier to debug and so when I echo this random gibberish into I was going to pipe it into word count which also has a character parameter so you can just count how many characters that is it's actually kind of fun as well do that so apparently I type 25 characters of gibberish basically taking the output of one program putting it into another one and then event just like chaining that overhead where you just chained them all together which is very fun but the question was actually how did I put that into my clipboard and then paste it and so on Mac this is actually a Mac feature I believe I don't know about it on it been to but you can type PB copy paste bin copy or paste board copy and that will allow you to copy whatever the output was whatever wants a standard out and then if I wanted to paste that I can either I believe PB paste is a command yeah so I can run PB pace to actually paste that from my clipboard or I can just command B and that will do that's like a clipboard globally or is it that's for the entire Mac computers so if I wanted to like that onto my copy and then I could type that gibberish here that's so cool that's really cool I'm a huge fan of using that let's see where do we leave off on hacker typer is the Learning Linux kernel source code which is oh ok that's right I think yeah for something coltan is awesome to understand my questions yeah my pleasure thank you so much Jenks decoy the D is silent in Django I believe oh yeah yeah yeah give us a big picture of why one should learn Linux OS and basically how we can become a skilled hacker like right so mr. robot scream of riff oh you guys are referring to the ship I understand a little bit better what we're actually talking about I was thinking you guys are talking about the guy mr. robot who I just realized that's also a show sorry one sec this is a little bit of a tangent but it is worth knowing about what is the name of ritual machine there's a mr. robot ah this is what I was thinking yeah was the mr. Kroop hot virtual machine which is a CTF style virtual machine totally worth that it's very fun I'm sorry I forgot about that cool now we're all on the same page and the question from frame of reference OS and to kinda break that down Linux is the name of the actual kernel just as an FYI and so kernel is basically the all-powerful being that runs your computer there is in kind of like low level systems classes and things like that people will talk about user land versus kernel land and user land is very pretty very like the rules all work people will break things they're controlled it's like it has regulation it's like a civil society kernel land is like just chaos just like good luck hope you don't die and so kernel land is basically not only we're going to talk too intensely on here but the Linux kernel has I think is on version 4.3 4.0 at the moment I could be entirely wrong on that it is a pretty recently developed kernel but it is a fantastic system for how lightweight it is it's very small I don't actually remember whether or not it's a monolithic style kernel or not and that probably was meaningless to a lot of us including myself but it is basically it was built by Linus balls which I'm hopefully not pronouncing his name too horribly thank you I think that's correct um and so he did basically I think he was mostly on his own and then there was a team that kind of added on later and a lot of his greatest inventions were the fact that it is a just very modular system so I can take all of these pieces and plug them into each other and get things out of it it's very clean as far as like that modularity goes you don't need a command individual command for everything you can kind of just go and you can build it with these building blocks to make all sorts of beautiful tools and stuff like that I'm a huge fan of kind of the Linux style of design I think that it's a very good like clean coding style and I think that learning any operating system based on the Linux kernel so like a bin - or like Arch Linux or things like that gives you a lot of understanding of just how your computer works at a little bit lower level and I saw some pace as we were going someone asked how you could find the kernel version you name - a also works it'll release everything my kernel is not cut Linux um as an FYI it's the Darwin kernel because I'm on a Mac but if I was on this which is a Linux machine in concert four point nine point nine three just as an FYI that lists all sorts of information about your machine and that was just kind of like booting up the machine like kind of tells you in the beginning yeah so it basically just displays that information back out to you you name is kind of useful in general it has all sorts of oh you type things you sorry yeah I thought you needed up a docker oh yeah I did this is a docker container but that is basically what's going on there nicolai AJ when - this is what are you guys doing we are currently answering questions but we're giving a Linux tutorial Linux commands sort of Link's flow and answering some other sort of philosophical questions yeah like how one can become a skilled hacker it's not a philosophical question this Madeleine is a lot of just experience right like a lot of what we talk about in our cybersecurity group here is basically you want to just go and learn stuff by experience by trying it and so what we do is we host upon the labs for people and kind of throw through it I have I have an open challenge I think to anyone in my club if they can avoid being hacked by me I think for like an entire session I'll give white hack not hacking way tagging this is all legal it's totally with their permission and we're not hacking their personal computers they all get the doctor machine we'd go from there and I don't think I've ever paid that out I'm looking forward to hopefully next year though I've heard there are some cool cool sort of like humble humble bread yeah I'm capo what do you work with ah so that's a great question and a very large one I'm generally speaking I like to flip between some form of Ubuntu I actually have one open I think I have a boon to virtual machine that I use for all of my projects for my CS classes and then I use my just built in Mac OS and it's kind of systems for the rest of things but from time to time I do switch over I do also have a Windows laptop that I use for a lot of other stuff it actually dual boots of into so I can't really get away from Linux and UNIX style machines but I generally try to stick to unique style stuff I like bash I like fish as far as shells go and I'm a huge fan of Linux debug says oh my god this is so cool why are you like I see that where you look at the eye doesn't it I don't necessarily agree but I really appreciate the compliments welcome also I'm cafe and JPMorgan I don't think we have seen you before and Naya AJ as well think you have to- lin Spota guar you just did many CTFs ah yes so C D F stands for capture the flag and something that a lot of cyber people do just for funsies and you're very right that is why I'm struggling to remember which one is which how do you find the kernel version you went over that young name - our room X says it's monolithic referring to them we pick some mix oh okay and then Nicolai or nikola J oh right okay it says that it is actually a hybrid of both monolithic and microkernel jinx Nico you can find this info on the Linux essentials let's get info for free before moving on to LP I see one yes that is very true I actually don't know what LP I see one is so you're welcome to explain that in the chat but yeah I agree documentation is a great way to learn a lot of things if you can read it ApS nice is in my OS course to learn that whenever we want to command the shell creates a fork process to execute commands what is the need for executing commands a new processes in the exec system call why it can't be executed why can't it be executed in the same process what is the need for forking ah great question we're probably not gonna get too into it because it is a very cool and interesting thing to talk about but also very cool collects relatively complex but your question basically being why do we have to fork processes why is every new process thing a a forked process why does every parent have to get a child and then like exec some sort of actual process in that child and the reason being for that roughly being that your computer has several processors but a processor give or take can only execute one process at a time or one thread at a time even and so what that means is that if we want to run multiple process or multiple like things all at once like having the screen display having like windows open or having like a Microsoft Word open and then also checking your email you want them to be able to run simultaneously and they do not share almost any of the same code and so basically what should happen there is you should be able to open up some process and then have it create a new child process that can do that so I believe I forgot the name of this one there is a just grandparent process I believe your kernel is that grandparent process and it Forks a bunch of processes out from underneath itself and then those become kind of what you end up actually using and so there's all sorts of really cool things in theory on that if you want CS 61 at Harvard has a great website for that it's you'll know you're there because it has the Hello Kitty icon I think and that Hello Kitty picture actually has a bunch of executive stuff in it which is kind of cool and they do a really great explanation much more eloquently than myself but it is a very cool way to learn all sorts of things about that yes the name of my cybersecurity club is Harvard College cyber club hc3 and we do all sorts of cool things at the moment we're kind of on a hiatus because I have been busy but generally speaking in the spring we actually go and compete in a cyber security competition we do the north eastern cyber collegiate cyber defense competition it's very fun cool ah Andre pointed out too that a Windows version of PV copy is x clip but in order to actually copy to the clipboard you have to make sure that you point out selection clipboard that's very good to kn
Original Description
Join CS50's Nick Wong for a tour of the command prompt in this tutorial centered around Linux commands (with compatibility toward other operating systems, such as Mac OS X, as well). In addition, we explore some other topics related to cybersecurity, programming, and more.
Co-hosted by Colton Ogden. Join us live on twitch.tv/cs50tv and be a part of the live chat every week.
This is CS50 on Twitch.
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from CS50 · CS50 · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Hello, World: Hadi Partovi
CS50
Content Distribution and Archival in a Digital Age
CS50
CS50 2014 - Week 1
CS50
CS50 2014 - Week 3
CS50
CS50 2014 - Week 0, continued
CS50
CS50 2014 - Week 4
CS50
Week 3, continued
CS50
Quiz 0 Review
CS50
CS50 2014 - Week 3, continued
CS50
CS50 2014 - Week 7
CS50
CS50 2014 - Week 7, continued
CS50
Breaking Through The (Google) Glass Ceiling by Christopher Bartholomew
CS50
Introduction to Amazon Web Services by Leo Zhadanovsky
CS50
CS50 2014 - Week 9
CS50
How to Build Innovative Technologies by Abby Fichtner
CS50
Light Your World (with Hue Bulbs) by Dan Bradley
CS50
Building Dynamic Web Apps with Laravel by Eric Ouyang
CS50
CS50 2014 - CS50 Lecture by Steve Ballmer
CS50
CS50 2014 - Week 10
CS50
This is CS50 with Steve Ballmer?
CS50
Meteor: a better way to build apps by Roger Zurawicki
CS50
Data Analysis in R by Dustin Tran
CS50
Data Visualization and D3 by David Chouinard
CS50
CS50 2014 - Week 6
CS50
Build Tomorrow's Library by Jeffrey Licht
CS50
CS50 2014 - Week 9, continued
CS50
Essential Scale-Out Computing by James Cuff
CS50
iOS App Development with Swift by Dan Armendariz
CS50
Sam Clark Leads Yale Students on Tour to CS50 at Harvard
CS50
3D Modeling and Manufacture by Ansel Duff
CS50
CS50 2014 - Week 5, continued
CS50
hello, world
CS50
CS50 2014 - Deep Thoughts - Hash Table
CS50
CS50 2014 - Deep Thoughts - Binary Tree
CS50
CS50 2014 - Deep Thoughts - Scratch
CS50
CS50 2014 - Deep Thoughts - MySQL
CS50
LaunchCode Visits CS50
CS50
CS50 Live, Episode 100
CS50
CS50 Field Trip to Google
CS50
This is CS50 AP
CS50
Week 4: Monday - CS50 2011 - Harvard University
CS50
Week 2: Wednesday - CS50 2011 - Harvard University
CS50
Week 1: Wednesday - CS50 2011 - Harvard University
CS50
Week 11: Monday - CS50 2011 - Harvard University
CS50
Week 3: Wednesday - CS50 2011 - Harvard University
CS50
Week 12: Monday - CS50 2011 - Harvard University
CS50
Week 1: Friday - CS50 2011 - Harvard University
CS50
Week 3: Monday - CS50 2011 - Harvard University
CS50
Week 10: Wednesday - CS50 2011 - Harvard University
CS50
Week 2: Monday - CS50 2011 - Harvard University
CS50
Week 9: Monday - CS50 2011 - Harvard University
CS50
Week 7: Monday - CS50 2011 - Harvard University
CS50
Week 5: Monday - CS50 2011 - Harvard University
CS50
Week 5: Wednesday - CS50 2011 - Harvard University
CS50
Week 7: Wednesday - CS50 2011 - Harvard University
CS50
Week 8: Monday - CS50 2011 - Harvard University
CS50
Week 9: Wednesday - CS50 2011 - Harvard University
CS50
Week 8: Wednesday - CS50 2011 - Harvard University
CS50
Week 10: Monday - CS50 2011 - Harvard University
CS50
Week 2: Wednesday - CS50 2010 - Harvard University
CS50
More on: Linux & CLI
View skill →Related Reads
📰
📰
📰
📰
How We Scaled to 1 Million Connections — and the Silent Kernel Bug That Almost Broke It
Dev.to · Vinay Kumar B U
Blue Watch, Day 4-6: From Alerts to a Story
Dev.to · Luna Meadows
Secured MCP Complete Guide: OWASP Top 10, Best Practices, Security Guardrails, and Compliance
Medium · AI
Whose ASN Goes on Your Leased IPv4 Prefix?
Dev.to · Artem Kohanevich
🎓
Tutor Explanation
DeepCamp AI