Operating Systems Crash Course for Programmers (Mac, Windows, Linux)

Operating Systems Crash Course for Programmers (Mac, Windows, Linux)


welcome back to another crash course where I pick a topic and pull out the most important bits of information that you need to get started today we’ll be talking about the differences between Windows Mac and Linux operating systems and how these differences can affect you as a programmer so in order to understand these differences we first must take a trip to the past and have a quick history lesson the history of computers dates way way back to the 1930s when a man named George stibitz and others were working at Bell Labs on something called boolean logic now we could go all the way back to that point and start there but I don’t think that that’s really relevant to us today what is relevant though is the personal computing revolution because it is the reason why we as programmers today have to deal with these three different operating systems when we’re writing code now why do you need to understand your operating system though why can’t you just program on your Mac and call it a day well the reason being is because you’ll be working with programmers most likely that operate different systems so you’ll have a group of programmers coding on Windows and a group on Mac and then if you’ve ever used a virtual machine practically all virtual machines run a Linux distribution so at some point you’re probably going to have to touch one of the three or more than one of the three operating systems so to understand this we start our story back in the 1960s at a tMT’s Bell Labs now Bell Labs is now owned by Nokia as of 2016 but back then it was owned by AT&T and this company along with MIT and General Electric we’re developing something called multix or in other words multiplexed information and computer services so they were trying to create this operating system multi for the general electric version 645 this was just a piece of hardware and if you see on the screen right here in the background that would have probably been the GE 645 so back in these days you have to remember that operating systems did not just come out of the box and you could just download it to a computer you had to develop custom software to run each new piece of hardware so that big machine in the background had to be custom coded if we wanted to type commands into a terminal and get it to do anything as you might guess the project was huge and many of the developers actually started leaving the project because of how complex it was but Ken Thompson Dennis Ritchie Douglas McElroy Joe vasana and probably others that I haven’t mentioned stayed on the project longest and eventually broke away to start their own smaller scale project which was called UNIX for you next information in computing services and this was kind of making fun of the original multics because of how complex it was but that was kind of how the UNIX acronym that does not really stand for anything came about and so they were trying to make this smaller scale project on combative compatible with the pdp-11 hardware so at this point let’s just take a step back and think about this so nowadays people like myself and I’m guessing most of the viewers have not been part of this computer personal computer revolution so it’s really hard to understand the origins of how we got to all these different operating systems people often get unix unix based and linux messed up in terms of terminology so we’ll cover all of this a little bit later but for now just remember that what these guys were doing right here we is developing the original UNIX operating system and this would come to be the basis of almost every operating system to come in the future so in 1975 Ken Thompson took a little break and went to the University of California Berkeley as a visiting professor he helped them install UNIX version six and that year they’re actually in 1978 won BSD or BSD stands for Berkeley software distribution it was released in 1978 and this was a UNIX based operating system so in other words it was just a fancy way of saying that they took the original UNIX and made a few tweaks and released it as their own BSD or Berkeley software distribution also going on in 1978 Steve Jobs and his team released Apple’s first operating system called Apple dos 3.1 now this has nothing to do with UNIX at the time it wasn’t until 2000 when Mac started running the Darwin distribution which was UNIX based and nowadays if you use Mac OS X that is what we call a UNIX based operating system so then in 1983 Microsoft enters the scene so this is where the operating system Wars kind of starts to get interesting in 1983 Windows released the first version or Microsoft excuse me released the first version of the Windows operating system which was a multitasking operating system with a very simple graphical unit in user interface previously in 1980 Microsoft had released ms-dos but as many people know that was a really primitive solution to personal computing because it had no graphical user interface so you can kind of think of Windows the Windows operating system as the front end of the ms-dos back end so windows plus ms-dos pretty much equals what we think of as the Windows operating system during this time and moving into the time closer to 1985 companies were getting pretty competitive with this whole operating system stuff IBM was one of those and previously Microsoft and IBM had been kind of collaborating because Microsoft was developing the operating system and IBM had the mainframe computer that the operating system was going to be coated for but during the release in 1983 IBM kind of got a bad taste in their mouth and started working on their own operating system this was also the year that the GNU project was started by a guy named Richard Stallman at MIT and this was a huge huge moment in open-source computing history because this project that Richard was working on was had the goal of creating an operating system that would be completely free and open for the public so in other words it had all the components necessary to run an operating system for free so clumb 1988 various companies were coding UNIX operating systems for various hardware devices by this point UNIX had basically become the de-facto or the standard operating system because it was manufacturer neutral you know you had Microsoft developing Windows and Apple developing Apple dos but those were not good enough for the open source community because obviously they were proprietary and you couldn’t see the code in them so UNIX kind of became the de facto operating system of this time and you might be wondering you know how did this kind of get out into the Oh and you know who released Unix I thought AT&T at Bell Labs was the original creator well from what I understand did some brief research on this UNIX was kind of distributed out to many different people because at the time AT&T was facing lawsuits relating to antitrust legislation and basically had to release it to anyone who asked them for it so come 1988 that’s why all of these different companies were working on these unix-based operating systems and by that time it was getting hard to kind of create a standard and the goal was to create a simple specification that these UNIX operating systems could kind of compile down to so that we didn’t have to have a different operating system for every single different hardware device so the Institute of Electrical and Electronics Engineers Computer Society or what we now just call the Computer Society or the OEE II felt that it was necessary to create that set of standards to allow what we call portability of operating systems or in other words we can download an operating system and put it on any hardware device that we want so this computer society developed what we call the POSIX standard which was a set of standards for processes signals file operations pipes the C standard library that we can still use today io ports and finally what we call a shell this leads us into 1989 where Brian Fox who was part of the GNU project led by Richard Stallman as we talked about a little bit earlier he was working on an upgraded version of the SH show so that the SH specification was the original shell or what we think of is like a terminal for the UNIX operating system and what Brian Fox did was create the born-again shell which was just an upgraded version of this and we now call it bash today we’ll kind of get into why I’m bringing this up and how it’s so important to us as programmers a little bit later but for now you can kind of see how all of this software was becoming more and more open source and available to the public to cap it off in 1989 Richard Stallman also released the GNU Public License which you may say okay that’s super boring it’s just a bunch of text that a bunch of legal text that specifies who can use what software but in reality that license was a huge moment in the history of open-source software because it defined how we could create software for many people across the world and the icing on the cake happened in 1991 so at this point the GNU project led by Richard Stallman had created many of the computer components necessary for an entirely open operating system but the only thing that was missing was the kernel you can kind of go look up what the what a kernel is on your own time it’s it’s very similar to a central processing unit but I’m not going to get into that so at this point we had all the pieces except the kernel frustrated by this leanest Torvalds the guy in the picture right here he created the Linux kernel which was an open-source operating system that was pieced together with the other parts that the GNU project had kind of collaborated on into a fully open source operating system so really the Linux kernel is not an entire operating system and it can kind of be paired with many different pieces and that’s kind of why we see so many different distributions of this today so fast forward to today and based on the general consensus that I came to with a quick Google search it shows that about 75 percent of the operating system market is Windows and you might be wondering why is this the case you know why is there so many Windows operating systems out there we know that Windows is notorious for its malware followed by subsequent Windows updates to fix that now we’re and so why do so many people like it well it’s not the Windows is the best operating system it’s just the best solution for the most people so let’s go through this by the process of elimination so we’ll start with the Chrome OS because that’s kind of an outlier Chrome OS was more of a recent thing so we don’t have to worry about that that is simply for their Chromebooks and I’m sure other things now let’s move on to mac OS so why is Mac why does Mac can I have a bigger market share well the reason being is because number one it’s extremely expensive you know how much it cost to buy a MacBook Pro these days and number two it is very proprietary and cannot be loaded onto any computer like the Windows operating system can now we go over to Linux and you might say oh well that’s open to everyone we can download Linux on any computer that we want but the problem with Linux is it’s too difficult for the average person to use and therefore it is not quite as popular so in the end Windows is really the winner because it is fairly priced and you can put it on pretty much any piece of hardware that you want so that’s kind of how we got to where we are today and hopefully in this brief history lesson opens up your eyes to better understand why we have to code for these cross platforms although things are getting a little bit easier as developers have created these bridges between the three operating systems we still do have to deal with this on a daily basis to better understand how these operating systems will affect us as programmers we will start with the differences in their file systems now with file systems we could get extremely detailed in our comparison between the three and start talking about topics like encryption file compression permission sets time stamps access control lists checksums and maximum file sizes and external drive sizes these are all very important topics to file systems but only if you are either creating a file system or you are like a systems admin so that’s just a very small subset of the people probably watching this and for the most of us we don’t necessarily care about all of those details but what we do care about is how these different file systems affect us when we’re actually programming and navigating through the terminal in the end file systems is about one thing and that is how do we handle all of these things that can be plugged into our computer through all the ports so if we had an external hard drive or a cd-rom or a flash drive or god forbid a floppy disk these all need to kind of come together into one cohesive file system and they all actually could have different file systems if you were to kind of right-click and do the get info on your one of your drives you can see which file system it’s running laid out on the slide here are the three operating system in their respective file systems so as you can see Mac has released their newest file system a PF S or Apple file system just recently in 2017 to improve on the old one hfs+ in on the contrary you’ve got Windows who is still using NTFS or the new technology file system that was released all the way back in 1993 as they say if it’s not broke don’t fix it and finally you have Linux which came out with ext4 in 2006 now notice I laid out a column on the right that says does it use a drive for the concept of drives and as you might have noticed Windows is the only file system that does so we’ll see what this means in a second if you look on the left the NTFS windows file system you can see that there is the concept of drives so you have the C Drive and the D Drive so what’s significant about this is each of those drives has a topmost directory so with the Windows System or the the NTFS file system you don’t have a single root directory like you do over on the Mac as you can see we have this little forward slash which indicates that the Mac has the one single root directory now if we jump over to the Linux file system you can see that same concept of the root file directory and what we call this is the everything is a file paradigm so in other words everything including your externally mounted hard drives in USB sticks are considered a folder or a file and for the Linux system particularly if we go over to the root and then /dev that’s where you would find all of your externally mounted hard drives up on my screen you can see a command prompt and the file explorer for a Windows virtual machine that’s running on my Mac right now so this virtual machine has all of the files that exist on my Mac which is the computer that I’m running except the one difference will demonstrate the difference between the file systems perfectly so I’ve got a bunch of external drives for example the external drive on Mac that’s like my big external hard drive and then you have transcend which is also an external hard drive as well as the parallels desktop that’s the VM that’s running and then this kind of virtual view called home on Mac so the Z Drive is where I’d actually find all of my files and folders now in the command prompt this is significant because if you’re working on Windows and you type cd’ forward-slash that’s going to take you to the root of something but it’s not the root of the entire computer so when I type that I just got to the root of this particular C Drive but if I wanted to go to the root of another Drive I’d have to first enter it so maybe I want to go to the home drive so Z actually I don’t type CD so just type Z : and clear the screen and now I’m in my the root of my z drive so as you can see with this Windows filesystem the NTFS we don’t have the concept of a single root directory like we do on Linux and Mac so we’ll take a step over to my Mac which see we have switched the screen and we’re no longer in the virtual machine this is at my computer and you can see that on the left we have these drives but they’re not considered drives they’re considered locations and this is significant because if we go to the terminal and type CD /im already there but we go to the top-most directory or the root directory we are actually at the top of our entire file system so we don’t need to switch drives to get to these different external hard drives all we need to do is go to CD /ba liam’s and then type in whatever external drive it is that I want to get to and that’s how you navigate around now this is very similar to how Linux works and I’m not even going to show the Linux file system because it is so similar so if we go to CD ford slash again you can actually find all these external drives either under the volumes or as you would see on a Linux machine they would exist in the dev folder so if we go to CD dev and then LS that out that’s going to show us all the things that are on my computer and if we scroll all the way up to where we see the disc listed out these are actually these locations on the left so I believe like disk number four would be the Zac external drive could be wrong on that but we could type in something like disk you till last and that’s gonna show us you know basically what all of these external discs are and the location so go back to that disk for that I was talking about and it looks like that is not the one so the external drive would have been disc three and you can see it’s an external physical drive and it’s running the Apple HFS files which is actually the old file system that Apple uses to wrap up our discussion on file systems there’s truly only a few things that you need to understand as a programmer to not get lost between the three operating systems just consider the Mac and the Linux file systems which would be the AP FS in ext4 these are very similar and for the most part aside from all those technical details that we don’t really need to know about they’re essentially the same and they’ll work the same for all intents and purposes now if we go over to Windows we have a different story because when we’re in the command prompt we’ll have to be navigating between different drives to get around so that’s the basics of the file system hopefully it kind of clears up a few questions that you might have had now that you have a brief understanding of the different operating systems file systems we can move on to the topic of command-line interpreters or shells now listed on the screen are the three operating systems and their default shells and immediately you might notice that Mac and Linux as with the file systems that were so similar also run the same default shell of bash so if we take it back to our original history lesson Brian Fox in 1989 was working on this thing called the born again shell or bash for the GNU project this extended and improved on the original SH shell that had come with the UNIX systems we’ll get into that in just a second but Windows on the other hand does not run a bash shell it runs something called command XE there really is no particular name for the shell other than command XE so that’s a little bit unique to Windows Before we jump into the actual demonstration of the different shells I think it’s important to understand what a shell is because these days when we don’t actually have the physical separation of these different components we get terms like terminal console command line interpreter shell etc all confused and we don’t really understand what’s going on on the Left we have a terminal which is essentially just a graphical user interface for typing text commands that will eventually be run on the operating system which we see at the far right now in order for this to work we need something to interpret these text commands and compile them down into the ones and zeros that the operating system will run and that is the job of the shell or the command-line interpreter in this case we’re talking about a Mac so it would be the bash shell so the process that it follows is it takes a Tex command from the terminal to standard in then it takes that text command converts it to an operating system command and then that operating system will do something and return a value to either standard out or standard air which will be printed in the terminal now instead of trying to conceptualize this let’s just break out of the presentation and open up my I term which will show us how this is working so if we type clear we can see that if we type something like echo this will print to the screen and press ENTER we will see an output right here so in other words this line right here where we wrote the actual command that was written to standard in interpreted by the bash shell and then the operating system returned a value which the bash shell again printed to stain out as this area right here so that’s just a bare-bones explanation of how the show works and it does work very similarly on Windows the actual process that is happening now what is different between the Linux and Mac versus Windows is the actual commands that you’ll be typing so if we type stuff like LS we can see all the files and folders in the current directory and we can type PWD to see where we’re at in the filesystem we can type maybe cat a test file out and then type clear to clear the terminal if we now come over to the Windows 10 command prompt we can see exactly what I mean so the first thing that you might notice is rather than using these forward slashes we’re using these back slashes to indicate our relative file paths to me as a Mac user and I generally don’t program on Windows at all this is really clunky to me to have to type you know the forward slash to navigate around but also what is different is all the commands that you’re using so you might say oh let me print out all the files in this current directory with LS well that’s not recognized in the command prompt on Windows so instead we have to type dir to do the same thing likewise if we wanted to clear the screen we can’t just type clear we have to type CLS so these are differences that can certainly be learned but as you can see there is a benefit to using bash across all of your systems because we have to use bash at some point if you’re doing any sort of work on a virtual private server so in other words if you have an Amazon web services or microsoft is your server you’ll have to manage that server with the bash commands so it’s useful to know bash no matter what system you’re running and for that reason Windows 10 has introduced something called the sub system for linux and i have this installed and enabled on this particular virtual machine and if you’re a Windows user wanting to switch over to bash just to make your life easier in general you can check out this video up in the top right corner so I’ll show you how this works all I do is type bash into the windows command prompt and what it’s going to do is throw me into a bash terminal now in that video that I linked to it’ll describe how this works a little bit more but basically now we can type all of the bash commands that we could type on a Linux or a Mac the last thing that I wanted to mention before we move on from the topic of shells is this never-ending confusion that developers and programmers seem to have with the SH version versus the bash shell so as we know from our little history lesson the sh show was the original specification for the UNIX operating system and in 1989 the born again shell or bash shell kind of replaced it as the better solution so we still have backwards compatibility to the SH specification and you’ll see this with in many of your unix-based operating systems like the Mac so I’ve typed out this little script so in my current directory I have created a test script SH and notice we’re calling it SH not bash if we use the vim Tex to edit this file we can see that all this script does is type the command echo I in the script so basically it’s printing to standard out this phrase right here but what’s tricky is at the top we have this little line that’s called the shebang and what this tells the script is where do we find the show interpreter to run this script and we can put the user bin SH to refer to the original not the bash but the SH shell and in most systems this sh executable is actually a symlink to the bash shell now it’s not always the case but in many cases that is what is happening so we could type sh up here in the shebang and if we exit out of here and type SH test script sh it will run it we could also say bash test script sh which will run the same script and we can finally go into the script again change this shebang to say instead of sh it’ll say bash exit out and once again we run it the same two ways and we have no problems so there is a subtle difference but I think this is a pretty popular Stack Overflow topic that people get confused about you know what’s the difference between SH and bash for all intents and purposes there really is no difference there are only going to be very unique occasions where you’ll have to worry about this alright so we’ve covered the topic of shells in the last thing that I feel is very important for us as programmers tough to grasp when it comes to these three operating systems is that of package management now if you’ve done any sort of programming you know exactly what I’m talking about here but I wanted to briefly highlight the three kind of default package managers that these three operating systems use and unlike the topic of file systems and shells the Mac and Linux operating systems actually run very different package managers and of course Windows has its own as well so let’s quickly dive into these different package managers and kind of see how they work on my screen you can see the three different operating system terminals all running a different package management software so we’ll start with Windows which is on the left now say what we’re going to do for this demonstration is install the vim text editor on each of these systems so what has been well been is simply in in terminal text editor so rather than something like sublime text vs code or atom which are much more complex in feature rich text editors the vim text editor is a lot simpler and it’s for easy quick edits to files that you might want to do so in the users zack directory I can type dir to see that I have this test file dot txt now if I wanted to see what was in that file and quickly edit it I would type them test file dot txt and it’s going to say them is not recognized as an internal or external command because I don’t have an installed so clear the screen and then using our chocolaty package manager which is what the default for is Windows we say chaco install then it says that them has successfully been installed so let’s clear the screen print out our current directory make sure we stole the test file there and then we type then test file dot txt and now we are entered into the bin terminal and we can add whatever text we want so some text and then let’s see if we can save and exit moving on to the right side of my screen this top little window is my Mac so to install them on my Mac we use the homebrew homebrew package management software we type it brew install then you can see that it completed in it put the BIM software in the path user local cellar which is where basically all of the homebrew packages are stored and so now if we wanted to edit files with them we could do so so vim test script and we are in that test group that we looked at earlier and finally we’ll go to a Linux machine and this is a little bit confusing so I’ve got a virtual machine on the left side of the screen I’ve got my computer on the top right and then I have a virtual private server which is running through digitalocean somewhere out in New York or something on the bottom right so I run a golf site and this is the virtual private server that I would use for that and so this is a Linux machine and to install them here what we type is sudo for elevated privileges apt-get which is the package manager and installed then and it looks like that installed so we can now edit a test dot txt file and add some text and save it and quit so pretty cool this is how we use the three package managers and of course if you are a coder you won’t have to use all three of these probably but it is nice to know like you know what the other developers who are using a different system from you are actually using to wrap things up I just wanted to kind of review what we learned in this video and recap what all this means for you as a programmer so of course understanding operating systems when it comes to file systems command-line interpreters and package management software you don’t necessarily need to understand all of these differences but it truly does open up a lot of doors when you understand what the developer on your team that’s running Windows is using while you’re programming on a Mac you can kind of understand you know what’s going through their heads when they’re programming on their computers now if I had to recommend any particular operating system I don’t think that I would favor anyone in particular but there is one thing that I would favor through-and-through and that is the bash shell now the reason for this is if you’re on Windows and you’re using the command exe it’s going to be very difficult for you to constantly be translating from the commands that you’ve run in that show versus the commands that you’re running in a UNIX based operating system environment so if you’re running any sort of machines like a virtual private server on like digitalocean or AWS or Microsoft Azure you’re probably going to have to run – at some point so it just logically makes sense that you would use bash as your base shell scripting language and the good thing on Windows you can download the subsystem for Linux and everything runs pretty much exactly the same except instead of trying to translate all of your bash commands into the windows commands you can just write bash code on all three operating systems of course you could ignore my recommendations and if you’ve used Windows for long enough and you’re just that is just ingrained in your brain then there’s really no reason to switch but if you’re kind of just starting out and you’re trying to determine you know what scripting language should I focus my time on what shell commands should I be learning I would definitely say that Bash is the way to go just because it is cross compatible across all three of these operating systems if you liked this video found it informative please be sure to hit that like button it really helps me out and it helps other people who may be interested in this stuff find these videos thank you for watching

Leave a Reply

Your email address will not be published. Required fields are marked *