Unix OS – Lecture 2

okay let’s get started with lecture number one and lecture number one is going to be a little review slash history slash fundamental slash the differences between Linux and UNIX and slash you know lecture number one for UNIX course so it’s going to be kind of boring for some but may be kind of interesting laning for others and I kind of go through kinda on the fast pace it’s about 50 slides long and so I’m say how far we get through purpose of the lecture go over the fundamentals of using Linux and GNU Linux like unix-like systems the history of Linux and UNIX basic system commands data management and constructing basic shell scripts so to discover a lot so see how far we get wouldn’t be appropriate without starting out with a history Dennis Ritchie and Ken Thompson actually Dennis Ritchie they used to call him I still do actually refer to him as like the Godfather of the C programming language in fact if you ever find one of his books and there’s they’re still in print actually Dennis Ritchie has a ton of books he is son he’s like the creator of C and you know long story short all UNIX is C so UNIX is a C programming language and slash operating system it’s built in C and it was basically created for a development environment by these guys so back in 1972 which doesn’t seem that long ago either 1972 well maybe for me it seems doesn’t I don’t know a number of different types of UNIX installation has grown to 10 more expected this quote was taken from 1972 so we had like 10 installs perhaps and probably had a little bit more than that maybe and then we had the boom so we had a lot of Linux and you excuse me a lot of UNIX and this is a UNIX as I’m referring to Linux came along a lot later and UNIX was made for large computers for special UNIX systems UNIX boxes as they refer to them that were made by let’s say for example DAC HP IBM and they all had their own separate versions of it as Sun sunset the Sun OS that works on the Sun hardware so hardware vendors were coming out with versions and breeds of Unix to support their hardware long story short so it’s all driven by hardware and so and companies like HP for example have their own operating system hp-ux the runs on HP and it’s Unix essentially sun everyone’s familiar with that Sun OS and then we have different programs that run specifically and they’re built specifically for the different Linux breeds it’s not cross-platform compatible as most people would think actually in fact even Linux is not necessarily crosscut it’s compatible to a certain point but it’s not the same operating system used in each one of the different the different builds are the difference but it is very close to almost being compatible and so let’s say for example you’re writing a C program and you compile it on ubuntu blocks nine times out of ten you’re going to be able to take that compiled file and bring it over a Debian system or a debian like Ubuntu which is huge bunch is built on Debian but kind of a sort of a like operating system that of the Linux variety and it’s going to work you take and you put it over on at hp-ux not going to work take and put it on a Sun you must not going to work you’re going to get you know it’s not compiler errors video you that executable file was made for a target platform or atomic target operating system it’s almost like the difference between loading something on a Windows and me box if anyone still has a me out there and Windows 7 well in the Windows days most of the varieties with the different versions so and they built on each other so like Windows 7 is supposed to be much better than Windows ME much better than Windows Vista hopefully and this Vista was terrible but in the generation of Microsoft in that operating system things grew in progression as upgrades different totally different in UNIX actually it’s the same operating system but what which changes is the software so we have applications that are get loaded the operating system operating system itself has been the same since 1972 yeah upgrades you know you know fixes and stuff like that made to work with different hardware but they say it’s systems and system it’s the same system so UNIX today in UNIX you know 1972 is pretty much the same actually ah and so what ended up happening eventually I mean we started out with UNIX and what ended up happening eventually is people so we want UNIX on a desktop computer we want UNIX on this other Hardware over there this you know and that’s where Linux

came into place so Linux is a stripped-down version of UNIX it’s a baby UNIX and it’s made for PC software I mean it’s good new PC hardware it’s made for desktop computers notebook computers desktops IBM compatible stuff versus the UNIX box so and if you’re not familiar with UNIX as a concept the UNIX boxes themselves oh here’s a picture of Dennis rich in ten pound you can stare at this picture a little bit longer now because you probably read the quote on the last slide and these guys a day they don’t look too fancy you know they look like grassroots developers and they’re not the spittin image of celebrities either but they are celebrities well actually short the UNIX is part of the movement of open source as well and Linux is open source you don’t actually have to buy this operating system when you buy UNIX boxes though you’re buying the operating system with the box so a Sun OS comes with a license of some software that’s not free actually that comes with the the Box I call it a box like call it a box only because that’s kind of the generic term for a UNIX box a UNIX box well it’s distributed computing what really is general and the large company is still still doing this but now the desktop computers are so cheap they just buy a dozen or so desktop computers and put one on everybody’s desk and hook it all up to Microsoft networking or the internet also we have a network we don’t really have distributed computing though we just have networking and so there’s a big difference between the distributed computing and you know like the internet well kind of there isn’t there isn’t so when and I’m actually kind of skipping ahead on my slides but I really haven’t gotten that far yet with the you can stare at these guys here we go som the old days in the original we would buy maybe I don’t have five six UNIX boxes for a company and you stick the UNIX boxes out there and somebody sits at the UNIX boxes secretary admin she does her work on the box answers the telephone brings up an application and then somebody else sitting next to her has a screen and that’s logged into the same box and then you know two doors the entities to every one it has these tricks these screens or terminals essentially well the terminals are all logged into the same box so we have one box that’s servicing I don’t know maybe 10 15 employees in the company and so we also have people who are working on those boxes they don’t have terminals that are working doing running background jobs doing system maintenance who are logging into those boxes so it’s kind of a funny phenomena because you know nowadays and you know the secretary the admin was sitting at the desk would go home at night shut the computer off no in fact we still have people doing that which is kind of weird and you know because they think oh that’s my computer I’m using this computer and so thin and idea I always conserve energy let’s just shut it off well if you should a UNIX box off you’ve probably taken down half the company because it’s not your computer it’s like not the concept of it being a desktop computer is kind of wrong it’s not really a desktop computer it’s the entire cut half the companies using that and it might be Beat Magazine being used for the web server web server might be running on that computer or something that needs to be backed up at night or somebody’s file system somebody else is logged into it I’m just kind of interesting and so when you do that you’ve got multiple processors essentially and all those processors are being used for different jobs so when you distribute basically I’m describing is a distributed computing environment you build in sort of a farm or you build in sort of the factory of boxes where you have more employees when you just buy another box no so you kind of figure out what the workload is the traffic is for all of your employees and you buy the number of boxes you can divide it out by hits per box and some sometimes you know your network has four or five six stations on and it just grows and it can strength so it’s scalable as well it’s not like everybody who comes on gets a new computer you’re just getting a new terminal it’s a screen essentially on a keyboard and especially called a thin client that’s what that was referred to and we’re going back to that actually with mobile phones and things that act like clients that don’t actually have that much processing and aren’t really doing anything I have a long story short and these guys revolutionized the concept by giving us the distributed on threatened and see and it was a development environment that turned into a distributed development environment where they can share work and have multiple people working on the same system together and then share processors so you can have one program running on several different machines or pieces of the program running on different machines so things could run

faster so you could develop run programs process information and run your company essentially on these UNIX boxes which is kind of the purpose of UNIX to begin with and then along came the you know the PC yeah this is long before the personal computer came out and then the personal computer came out and people say well you know you know you get this box well now it’s a computer and now it’s going to be like you know sitting on people’s desks so then they’re cheaper I mean actually right now you could buy a PC buy a notebook computer for way you know $200 or something lets you per than 10 or 15 grand which is probably the current price right now for UNIX blocks so companies started stripping it out and what ended up happening is they lost they lost the ability to back things up they lost the ability to share files across different you know different computers and they separated the data out into you know 200 different laptop computers that got stolen or they or they broke you know and they lost data so then we’ve actually gone 360 degrees back now we have servers so and we’re doing a cloud computing which is essentially going back to distributed computing taking and getting like five or six different UNIX boxes and putting a cloud on them and then having all the users login to the cloud with their dumb terminals but now their dumb terminals or cell phones and tablets and you know maybe there’s maybe their notebook computers you know there’s there something that it’s not smart it’s not but it call them dumb because they don’t need processors you don’t need a strong processor for it I should say you need a keyboard mouse perhaps you need a window screen that’s about it that’s pretty dumb you don’t really need very much outside of that they also call them thin because they don’t have hard drives then a true thin client doesn’t have a hard drive on it a dumb terminal doesn’t have anything outside of a network connection screen and the keyboard so we’ve actually gotten 360 degrees in the in the year 2012 especially with that you know the invention of the cloud we went from servers to computers back to servers so now everything is stored on the Linux system so now even though you know we’ve got you know the buzzwords like cloud out there and what’s a cloud it’s a UNIX environment it’s a distributed computing environment we have cloud space we have cloud applications and services and things so ok now that makes UNIX more relevant you know for a long time people stopped studying UNIX you know what do you need UNIX for I got Windows is thing ok but you know now you know so even if you’re working with modern day cloud you gotta have something about UNIX in your background otherwise you can’t run a shell script you can’t your route you’re working on a UNIX box essentially so maybe going back to slide set I gave you a little summary a history where we were where we’ve gone to now we’re back to it as take taken a jump so 1972 is this kind of slide you’ve been staring at looks like here Dennis Ritchie wrote B and then came up with C after that so in terms of the generation of programming languages C was kind of the end of that kind of no I should say if C++ but that’s kind of different than see that’s object-oriented languages C was pretty much the last UNIX language out there so we have scripts that support C you can in fact every UNIX builds got GCC on it open source C compilers and stuff we have the concept of the pipe where we write a program to do something and then we do it you know hopefully they do it well we write programs to work together we pipe information back and forth between the programs because we want to share we want to share applications we want to share utilities and programs and things so we programs can handle text streams because there’s a universal interface between the different programs that’s created with this pipe concept so bringing Munich’s to the desktop this is where linux comes into play unix is very expensive as i mentioned before it runs on big old machines Microsoft DOS was that was the mainstream OS was then we had Windows and then we had MINIX and tried but you know not a full port MINIX was a kind of a minimized Linux version or UNIX version and then we have open source solution and we came up with open source Linux so that’s why can I say in the beginning UNIX really isn’t open source it’s made by manufacturers of huge huge mainframe computers are huge big ol servers server systems Linux is open source most of the software on UNIX depends on what you’re good looking at a lot of it’s very expensive actually because you have to have custom-built applications to run on hp-ux on OS and these applications you know takes

skilled UNIX people to create and they’re not sold by everybody in America there are in the world there are only one or two companies buy them so they’re extremely expensive and they’re expensive to maintain and support Linux on the other hand everybody’s got Linux and everyone’s supporting it and we have people that are out there writing open-source stuff so applications are cheaper than Windows applications anyone who is you know found themselves in a buying and when I don’t have Microsoft Office well you can get openoffice.org almost as good as Microsoft Office now runs on Linux also runs on Windows now too but it was originally a open source Linux kind of port of Microsoft Microsoft software so back in Linux 0.02 that was actually going back down memory lane again here 1991 so from 70 to 89 if 20 years later took about 20 years to come out with Linux so you can read the quote these are these slides have some pretty interesting quotes on them that kind of when I run and read it I go on so Linus the only thing really to get important to take note of this quote if you read it is that who wrote it so this is the godfather of Linux which is not Dennis Ritchie it’s Linus which you know comes up with Linux so the name actually comes from this guy’s name so Linus Torvalds if I’m saying that right Torvalds or something of that nature linus everyone remembers that as linux linus so he’s actually the one that kind of came up with the linux concept it wasn’t really didn’t come from see did not come from Dennis Ritchie I just came from this guy who ported it over so still maintained monolithic kernel in 1991 according to this 1/2 an L there well I’ll talk about monolithic kernels will talk about kernels before this lecture is over with but the concept being and you know or just this you can get a you you would not get a high grade for such a design a lot of everything they said the pass some of that stuff was a came true some of this stuff was irrelevant sometimes up they were really wrong about it’s kind of like they again the first PC came out and who’s going to use this why do people want this now everybody has won this one so 1990 the movers and shakers richard stallman father of gnu project this guy actually writes some really good textbooks he has one of the best operating system books out there and son he also writes a lot of programming language cons books if you ever run across a Stallman text it’s it’s far above average it’s better than not a lot about the authors out there because the guys really experience and so he came up with the GNU project which is jeanna open-source it’s kind of it’s it’s a it’s an off spring of open-source essentially it’s the ability to share so you have a group of programmers who are all working together who are all developing for the effort of computing and for borrowing or being able to access source code they contribute and so there’s a GNU license I’m sure you’ve seen them a lot of software that you know gives credit and says that hey this is open source which means you can’t make it for profit you can’t take GNU software and put it inside something and sell it it doesn’t work that way which makes open source open source makes it open mix and it keeps Linux and Unix well I should just say Linux at this point free and cheap been affordable versus Microsoft which is a for-profit company whose sells products here’s a – turbo is a term Alice is the maker of Linux essentially so why a Linux UNIX why is it still being used well is it still being used it is still being used I mean why should I just mention the cloud a few minutes ago that’s the basis it’s a UNIX cloud in fact the Internet is UNIX you log in from your windows box and you do a unix translation which is why if you’ve ever got a macbook you might notice that internet actually runs a little faster as there is no translation you’re going unix to unix which brings up an interesting concept developed Microsoft versus Mac and versus other desktop operating systems Mac books run on BSD UNIX one of the original actual grills from Berkeley it’s Berkeley UNIX actually so it’s a separate breed of it that’s the core of the operating system Microsoft Windows runs on ms-dos Microsoft us before we had microsoft office we had PC DOS had dr. das we had all these dos which stood for disk operating system we’re talking about the history of the you might as well talk about the history of das as well and it was command-line interface obviously you know everyone guys remember don’t you guys still use das right I was I was all right I was I read another college talking to undergraduate students are like dolls what is that

never heard of das I think like how in the world did you at making a hundred well do not heard dass so you know there’s a little icon on the desktop says do s on it ms okay alright so ms-dos was Microsoft’s version of it we had in the beginning it was part of GNU project actually the port to Intel processors the port to desktop computers well we got this real fancy little desktop because this before notebooks came out what do you do with it we’ve got a lude something on it so the DA sport was sort of the stripped out command prompt that you got with Linux which is kind of interesting because this took a 360 degree turn so UNIX started out command prompt it’s got a man line interface which is do memorized a bunch of commands LS and bi and stuff yeah everything was command run and then Doss comes out and daus’s come in based and then Microsoft picks it up creates Microsoft DOS right and then we have Microsoft Windows remember 3.0 Microsoft Windows I typed in win you went to it you put it to a DOS property type in WI in win and you press return and you could escape out of Windows it was an application it was loaded on top of DOS still is Windows 7 is still an application loaded onto in fact you can stop Windows 7 and go to a DOS prompt so you can actually take it off and go to a DOS prompt if you wanted to and you can get to a DOS prompt which a lot of people think is a shell but it really isn’t the shell you’re going back to the underlining operating system that’s underneath the windows what’s the windows well on unix people they call that a desktop so it’s a desktop that’s loaded on top of ms-dos Linux is the same thing we have kernel we have the underlining but they don’t call an ms-dos it’s not an estas it’s instead it’s Linux and we have a desktop that we load on top of it so we can put grom on there Katie tons of little desktops some of them actually look like windows now which is weird so in fact if you were if you’re interested in using Ubuntu happy by actually I might all at the when I get done with this lecture after lunch I’ll show you Ubuntu it looks like animus it looks like looks like windows actually looks like windows 7 actually it’s nice little taskbar and stuff in fact you can get desktops for Linux that look like the Mac OS that look like Windows 7 look you know and then what advantage do you have only you’re not using Microsoft which means you don’t have to buy Microsoft software you can buy a Linux software or better yet you can download for free everything is most of the stuff is open source so it’s a little cheaper plus it’s nice for development hard to develop on ms-dos that’s why a lot of people buy Mac books for C programming for Perl for PHP for Python for any programming you want to do much easier on a macbook than it is on a Windows system is what you’re doing on a Windows system is you’re running on top of ms-dos you’ve got your Windows desktop on there they’re going to learn another emulator on top of that you’ve got to put on you see something or other you’re going to put on linux shell if you’re going to do anything in terms of c you’re going to program and see you’re going to run it Visual Studio you know a favorite never knows how slow that thing runs loading up an environment it’s simulating and now it’s all integrated with net which is not compatible with anything else by the way it’s just if you’re going to do windows development you’re going to do windows development that’s it I’m going to be doing development for other platforms because it’s a total separate breed in itself if you do Mac development you can do development from any other gnu/linux you can program in threads you can write Linux programs on a MacBook you can write Internet applications things on a MacBook you know John is pretty much the same on a Windows machine as it is on the MacBook but the interesting thing is that because the MacBook doesn’t write on top of ms-dos it writes actually on top of BSD Linux core it’s more compatible bottom line developers prefer it because and I can show you you know we can go to a terminal prompt and you can actually run Linux commands you have a Linux build essentially installed on so if you’re taking this course you have a MacBook which I see some of you do you don’t have to install anything you got everything you need for this course you can do all of the assignments everything on your macbook so if you have a Windows machine you’re going to boot your system up to a Linux version 1x craft you might some of you might actually do a dual boot and actually install it Jenna might actually be fine I’ve done that to old computers actually outdated computers that don’t run Windows 7 or something huh but it put it install Linux on it it’s a nice little Linux box alright so why use it is just around 30 plus years of development tons of development going back to the reason why people like it actually

I’m development tool more many academic scientists system tools development tools GCC compilers free Perl Pete you know all of those other languages that I mentioned that are open source languages so if you’re doing internet development you’re doing any type of programming UNIX is your home you’re not going to do this on a Windows box unless you’re getting into dotnet and you’re on a separate which actually kinds of kinds of brings up with a separate kind of Windows topic in terms of Linux Windows Microsoft actually has a Microsoft server and they actually have their own breed of Unix Linux not compatible with everybody else which is weird so you take you know in terms of compatibility which you know either you’re a Windows house or you’re not yes if we go the Windows route you’re stuck you’re stuck on dotnet clients and you’re stuck on Microsoft servers because you can’t run Microsoft clients on non-microsoft Claire oh you can’t connect them to non Microsoft servers and you know if you do the database route you got a big Microsoft server sequel server I mean you got to go Microsoft for everything your database your server your hardware your client interface you’re stuck there’s more mixing and matching with other operating systems especially in terms of you know going with something more generic and actually called generic really in general but HP or Sun Suns pretty good with a generic system of choice these days in fact I would almost venture to say about at least 70% of the Internet is on Sun it’s all send servers when you log in you’re logging into a Sun server most likely 70% chance I want to say probably higher these days but yeah that was a statistic I ran into like a couple years ago so I’m pretty sure it’s like 90% at this point that’s because they’re good – nice good solid systems and they last forever so scalability lightweight easy development some basic stuff as I mentioned before we have the command-line interface so it interacts with the UNIX and Linux it’s based on entering commands and a text terminal not so much in fact I’m going to show you as soon as I will probably I won’t do till after lunch but maybe before it looks just like Windows is just as easy to run a desktop and have it loaded and I’ll show you Ubuntu actually I haven’t in a virtual box I have Windows in a virtual box too as well loaded on this thing that dem looks just like Windows so there’s no need you know they worry about the command but in the old days people were really worried about the command man lying fraud because they had to remember stuff which is kind of interesting because now we’ve gone full circle we went with Unix then we went with Doss and then we had Windows on top of DOS and then now we have Sun OS Sun windows on top of the command line prompt yeah so now everything is graphic everything is going and so the OS X is the BSD desktop that runs on top of the BSD system on a MacBook so interesting everything’s now gone from command line away from UNIX back to UNIX and now windows gave us Microsoft gave us the GUI pretty much depends on who talked to some people – it still comes from Xerox PARC but it probably does but you know there’s a nice little thing on that as I was used to be on the Discovery Channel and it was also on Channel nine years ago it’s like the history of the Silicon Valley shows the hole eventually for UNIX course that’s not a bad read it’s not a bad movie to watch because it totally gives you much more history than I just gave you but it takes two hours to go through that mystery but it’s kind of interesting to see how Windows was developed and how that whole GUI kind of revolutionized in the concept of the mouse and everything kind of just changed computing in general but we’ve gone all the way back around we’re back on UNIX now and we’re still using desktops which is cool so so sometimes there are no warnings with commands no undo no features no buttons no no colorful icons either we have to memorize commands and users don’t like that memorize commands which is why everyone loved Windows just click on a stuff and advanced stuff it was easy right so actually for a while people were thinking that the Mac was easier and it was easier until Windows got better Mac my could Apple took some Windows people’s away for a while but down there I don’t know I don’t know what’s going on with them so they’re taking the tablet people now so so the show the concept of the show so the user environment that enables the interaction with the kernel and a low-level operating system Windows Explorer would be the shell for Microsoft Windows probably now they tried to integrate the Explorer if you remember that version I think it was the one right before I think it was right before XP was like

the start of XP the Windows Explorer was part of the you know the well we still have the Explorer but it was part of the browser and they tried it they still trying to do that or you can go to a you know Windows screen and the browser is it like a file manager or is it like a Windows browser or is it like an internet browser I feel like that distinction was kind of blurred still is kind of because you can get address bars that look like URLs at the top of your folder icons and ephah in Linux UNIX environment the concept is you’re always connected anyway you were networked so there was nothing about being off the network you were always on the network so it was kind of funny how I Dawson windows I could get on the network you know now they’re they’re gone full circle so they’re on the network all the time in fact if you have a Windows computer and you’re not on the network you’re hosed because you Computers and be trying to update constantly and trying to do stuff because it relies on that connection just kind of everyday kind of observation so common shells in a Linux UNIX environment we have the SH shell the original unix shell still located in bin sh we had the bash sal shells is UNIX shell written for a GNU project installed on most Linux systems we got the C shell model F 2 C programming language allows you to write programming language damage you can print F you know and scanf you can use C commands and the shell prompt T shell shows modern improvements such as the file name completion we had so many shells Beckley this is just a small list these are the common ones that are still in existence so one of your programs for this course is you’re going to write your own shell so now get to write your own C shell and it’s in that bad experience because that’s what everybody did that was like the desktop without the GUI so you made special commands made it easier for the user he kept a history of the come in so you can go through the history we had some automated tools you put in the show and then we had a dozen of these shells out there and imagine what happened with that I don’t remember all these shells you know what if they had like a dozen desktop versions of Windows I do sort of but when people are down to one or two you know XP or seven right now but what if you had like add 20 more on to their clan but eventually people are just going to all do the same thing so they’re all equivalent and we need then what do you have left with one desktop so what ended up happening with the shells is that everybody’s chill was starting to look the same well so what’s so supporting this command and someone so uses that command you know all of a sudden everyone’s supporting everybody else’s shell all the same there’s no difference really in the shells so I mean the only significant difference would probably be the C shell these days but everybody supports C in terms of the shell interface and you find out this show in fact the show commands actually work on a MacBook you can find out the shell I don’t have my terminal load loaded I’ll do that later and I actually the show run some shell commands and actually I have to do that now they can find out the shell so if I go to a terminal prompt on my macbook and i’ve made the window a little bit bigger you can run like LS as an example or you know a list of the directory you know and then windows is equivalent to the windows dir you can type in shell and you get to shell you can type in whatever supported – I can go to bash shell and what I’m doing is loading a shell on top of a shell on top of the shell so I can exit when I did was I just I loaded actually two different shells and I can exit I can go back just typing in exit well now I’m back to the shell back to that shell until I can eventually exit out completely but the concept of the shell is interesting it is not the same as going to a DOS prompt when you go to a DOS prompt from windows you’re going to the underlying disk operating system for the PC that you’re on when you use shell you’re going to a different session on your UNIX box and that’s how we get 20 people all sharing one box going back to what I was originally saying they have shells they have terminal interfaces they have desktop interfaces they have sessions some of them are local some of them are remote some of them are from two blocks down as I walk over from like right in front of the box so here when I opened up shell I have a shell that’s a login that’s an account yeah it’s doing something so if I opened up another window here as an example I have two shells this shell can be on this computer I have two shells on one computer right now opened it they don’t have to be in a UNIX and a real UNIX environment these could be on one computer or they can be on different

screens and what they are there are different sessions so when you tell net which this comes from the old original days you open up a shell and your shell is your interface to the box so this could be one user on one computer there’s going to be another user on another computer all sharing the same processor here this is a desktop computer Allingham but you can actually log into my computer could tell if I opened up the port on this computer and you could tell that in and open up a shell the shell is your window or your session into the computer and in the shell you can load a desktop you would have a GUI it would look like your computer essentially but it’s not your computer remotely logged into another computer or something so that’s why when you put the UNIX boxes in fact they don’t do it anymore and the old days they used to put the UNIX servers out on the admins because it’s a big old box where you’re going to stick it right so you stick it up and then the admin turns it off well now they lock it so you can’t touch that can’t turn it off because we turn it on we lost your webserver you lost your financial program your database everything cuz it was all loaded on that computer and most of the company logged into it you know all the stations all the terminals everyone’s like then if you’re logged in what do you get you get full directory structure which is and the reason why I have this up here is I kind of want to show you you know there’s an entire directory structure on here hoops swisco PWD it’s the root and so people go well you know when you’re in a DOS window and you open up a DOS window on it MS DOS computer and you’re one user you’re the same user and you’re the same you sharing the same file structure you’re sharing the same hard drive I’m sharing everything is the same it’s not session oriented although Windows does have user accounts and user directories their approach to the entire concept was to make it what is it my documents or some no direct documents and settings or something like that there’s a thing they created in Windows XP I believe they each user has their own documents and settings and you have to go through and it’s all on the same hard drive and it’s all on the same computer so all the users are pretty much sharing all the same files not the case with UNIX because this mapping that you have and this is a good example of it actually starts with the root and then you’ve got the user level that comes up from that well this might be on this computer it is actually but if I were to log into a another UNIX box it might be on and so I say I have five servers it might be on I might be having part of my files stored on server number one part of it on server number two part of it on server number three because it’s distributed certain applications that I’m going to be running are going to be on different locations so if you think of the concept this hierarchy of the directory structure isn’t the same as a Windows directory structure it’s not your partitioned hard drive instead it’s a partition of five different servers and your mat so you have a you have a logical environment space that looks the same for you every time you log in somebody else has a totally different one that looks the same for them and they can’t touch your stuff they don’t even see your stuff they have no idea what files you have they can’t go in and touch it essentially it’s protected so a lot of people go to the UNIX route because not only does it put everything all on the same computer even though it gives you have each user it looks like you have your own your own environment essentially set by your login and your mapping you have your own shell and you have basically looks like you have your own computer but essentially located so you can back it all up and only not but you can centrally manage it so you can have a system administrator come in create user account straight login scripts give users access to certain programs and don’t give them access to other programs so not everybody has the same computer I mean they’re not all using the same computer they’re using their version whatever it is or game writes do so UNIX when we think about it has the ability to set for every user different programs different logins different shells and this particular example showing us the environment variables that are set as well and I’ll just run this for you so you can kind of see in the linux world we set environment variables one of them is the shell that we’re going to use and this is I believe a bash though but I’m going to find out real quick actually because it should be stored in my environment variables so if I load up actually I’m scary that’s wanted to show you the command and run it for you so you can sort of see what’s going on here here it is and so if I typed in echo and this will work hopefully after a price I did it if I actually have the environment variables set let’s see there it is it’s going to tell me what

my shell is in my shell – already running a Hyundai number one we’re already running Linux commands and we’re looking at the environment in fact since it prints in V Werks actually if it does if we type in print in be back when we go back up there so you can just see what I did it’s not that on my computer it’s not this is BSD Linux it’s not case-sensitive on some systems it actually is case-sensitive unix command prompt is case sensitive the most part and but this is a hybrid version of it it’s a Linux / underlying Apple version of it obvious Berkeley UNIX so in fact I think the dir command actually works in this so my shell is not case-sensitive for certain things but long story short what I just typed it was like typed in print in v4 environments so one of the things we do in Linux and we don’t do in the Mac what we do in the back excuse me we do it on the windows box in the old days when people used to set their path and then you say yeah and your boot it up Windows you how to exec top that file and had a config dot sis and you set your path the path configured your system for a arena can’t make things available so you can run them from anywhere on your computer will take that and times by a thousand in terms of the features and make it into a true interactive environment with the environment and then you get the Linux environment in the Linux environment when you log in you have a login script login script set your path it sets the environment variables and part of the environment variable stores information about you one of the things that I’m showing you here is that it stores what what show I’ve been assigned to and it’s coming out of the shell so if I go echo you know a show I can find out that my shell is been bash I’m actually using a bash shell I can change my show if I want to by changing my login my mount my login script in actually it’s more than just when one login when you when you go to the terminal window you can change that script as well and but long story short the environment when I printed it out is going to give me all of the information it’s stored so it’s more than my path or it’s more than my class path or it’s more than you know all those little things that you can kind of set in DOS it’s like it’s like the DOS capability of the environment times a thousand really because you can store a lot of stuff so what I mean UNIX people do is they use this kind of like programming so going back to programming for a second as imagine this environment was created for C programmers what a C programmers doing when I got into dry float F double D you know all these variables in a programming language on you can put your variables in your environment and then you can manipulate your variables and so it’s like programming in a shell so you can you know you can say you know term is going to be equal to X color and shell here’s my shell here’s the command here when I typed in echo give me shell this is a variable shell is equal to been bash and it’s used in my environment to set my configuration my properties it’s like I said the modern work for that temp directory user users be hacker here that’s how I’m logged in command mode languages English you know password I don’t have actually I took the password off and say don’t want to do that and then I can actually switch I can say you know as an example you know the common thing people want is supervisor privileges so you type in you know su is an example it’s gonna say password okay put my password in here oops sorry I’m going to take my password off nope I didn’t I hit I do have a password on here which is going to interests have to remember what it is now long story short I can law again as the supervisor by going su I can also login to somebody else by going to log in at space another user user camp it’s on here and I can actually have like 25 you know many users I have on here logged in simultaneously and then I can exit out of them close them down so the concept of this session is kind of important in terms of what’s being accomplished with that and so going back to the slide so actually I’ll just leave that window in the background put this back up so it’s in full-screen mode so you can actually see it and I’m gonna get too far through it so smaller there again then it that far through and I’m here so so as you can see as I’m we’re going through what I’m going to do for most of the courses just use my Mac book because it’s Scott Linux on it it’s full ready to go all the commands work so you can change your shell which means you know I was typing in different shell names and I was actually loading up different sessions and I was actually you know using utilizing resources on my computer when I do that if I wanted to you know not

load up a new session we just want to login with a different show I can change there’s command harris’s change the shell and then change my shell from bash to SCH why do I want to do that because there’s different commands that work so in fact I can write my own which is what you’re going to do for your first assignments you’re going to write tiny shell you might come up with a bunch of commands actually to automate some of the work that you’re doing and then you can just load on your show change your shell sudden you got your own operating system essentially it’s your own customized shell so it shows are dime a dozen and people still create them and they automate work they make it easy to kind of you know go run through stuff another kind of thing that was kind of interesting is the man man pages so when you had a question you wouldn’t ask the man it’s a man a man is short for manual and this believe or not is still if this actually there’s an internet version of this one of the oldest manuals from Linux because nobody memorized everything fact you’ll see when you know when you go in and start typing in commands like you know 25 different see what manual page do you want no let’s take what I just did as I typed in ma n for man this is I have manual because I have BSD Linux I’ve got the no pages let’s let people take it off actually because it frees up space you can also get through it on the Internet I’ll show you in a few minutes there’s a web version of it as well but it for example if I type in men’s going to ask me what am I also going to man space LS it’s going to give me the manual page for LS the manual page for LS is going to be this is the bsd general command manual it’s going to show me all of this you know description of it Plus here’s the schnapps this of all the different switches I could possibly use with this so I can go in and what I’ve got here is I’ve got a more automatic more that setup on here because I’ve got this colon here and so I can go you know press the return and I can go through I don’t know how long this is really but these are a bunch all the switches but I can type on the LS command as an example and it’s kind of interesting because a lot people don’t know that there’s different ways of doing stuff yeah as an example if you typed in you know dir it pretty much is the same as LS my first UNIX command here we go so this is lists out the contents of a directory this is still going make a press control-c to stop it who said I just get out of here my ctrl C didn’t work I did Mark said command C okay we’ll just I’ll just keep pressing this Nuggets to the end yes excuse that excuse me oh you’d have to I have no idea you have to read through the man fingers here one of those is the size of directory actually I think it’s minus H but let me actually I’m going to run it real quick to find out there we go and finally let me just close this window actually hmm and now you’re testing my memory no I don’t know what it is really it’s this one one of the assignments actually has you run through like five or six different LS commands you know is that where you’re asking the question from haha if you wanted to however you can actually go out to the internet here we show you the internet version of this and I don’t actually have the link safe but if I type in manual or man let’s just type in man well that’s going to be the Wikipedia version of it and I’m looking for is the manual pages so that’s not going to be it’s going to be a company so you know we’re so commercialized these days let’s go this second UNIX UNIX manual there’s a couple reason here is the online UNIX manual pages here we go this is the man this is this is the graphical user interface for those people who don’t like command prompts and you just saw a few minutes ago pressing more pressing return on that is just kind of tedious but you can look stuff up if you go to LS here you can say well here’s the LS command here it is down here on the bottom and then I can see this is the same page let’s make this a little bit bigger this is that same page that I kind of thumb through a few minutes ago you know a command prompt well the concept was it was you know loaded you go to a terminal he opened up session you can that was the way you did it in fact you can bring it in an HTML format as well from the same prompt but I hesitate hesitate to actually do that so if I want to see for example what was your question he wanted to see directory size see what happens

when I search on it see directory let’s say I spell it right let’s just go to your size size like that I’m just go to the next one use bytes for blocks here we go human readable human readable that’s the H that I thought would bring up the size but it did actually with the minus L print sizes and human-readable okay that’s not what I want anyway you can go through the manual page here – Kay I’ve actually believe – Kay is it let me just check out what a quick know okay so anyway but this is how people look stuff up in the past sound I figured stuff out the reason why I’m sort of showing this to you is because you have a couple of assignments they’re going to have you know what is the command to do this what is the command to do that Oh answers to all those questions are in the manual so you can get to the manual by the website you get to the manual by typing in man you can figure out what the switches are stuff like that and they call them switches parameters that you said so that’s going to help you significantly with one of your actually a couple of your assignments actually and in a way the way I got to this was I infect this is from this is the UK version of it and I just did a Google search on UNIX mad well just how it came on so let’s go back to the PowerPoint that’s still in the background here I believe hello okay let me just bring it up manually close that one down there we go all right so uh reading the manual nobody reads the manual they use it like a dictionary or like a look of glossary so you can go manual – K key word for example and you can based on the keyword you can actually you look at stuff most of the commands have a built in UNIX manual even the man command actually has a manual for it let’s see get the manual on the manual on it you can also get help with it by using the minus H or the – the for skimming for / with the question mark and you see a lot of UNIX utilities that are written with the same kind of format so everything has a minus H switch – age gives you the help show you how to run the command normally keep in mind however man manual pages includes not only all the basic unit commands nuke unix commands but if you install software such as openoffice.org or something like that you’ll get manual pages for that – manual pages get installed for everything that actually gets created for so it there’s a manual page for it they’ll get it it would just be added to your entire list so the manual pages are divided into eight different sections depending upon the type of command you’re looking at as I mentioned before get third-party tools and things loaded to it commands and applications would be the one of them system calls I’m going to be talking about that today as well see library functions actually it’s not a bad for programming actually you can get Manuel de Edsel Linux SC so on printf and scanf a little c commands for special files 5 would be file format so you can get the manual page rank games miscellaneous system administration utilities and things how do i do a defrag or something at fsck or something like that there’s a manual page on everything so so some conventions for this particular lecture because what we’re doing isn’t in the beginning is going through a bunch of commands and things and utilities so the way that this lecture is a lectures too short to give you all of the options that are available i’m not going to in fact that would bore you to death to sit there in fact if you have a computer you go to actually see this you can go to your terminal prompt try this dust the stuff out while you’re doing it however you’re going to just a lot more than i’m not going to show you if i went through every single linux command only would you be bored but it wouldn’t accomplish anything because you have to remember it no one memorizes sistah but people memorize is what they use most often so and I’m going to show you the most often ones which is just a handful so commands will be in bold in this lecture and options will be in italics so it’s going to look like this but come in with the italics next to it and so the output will be shown in its own border table so here we go so some basic common conventions so in terms of the help files as we’ve seen and manuals of sales commands will have the required input and option out excuse me required input and option input so the option here says it’s optional this it’s not optional it’s the option so this is a CP command as an example so CP is a copy command so if you’re familiar with DOS a lot of them have the same kind of naming convention to it if you typed in the CP command it’s expecting to – optional or not options but two options

that go along with it we need to source we need the destination so the options here are the optional arguments are in the brackets here let’s say this is the option and required our arguments are not so we could say CP a source destination well that’s actually not required but this one is required so one of the things you run into its people like Bren commands their own special way by shortcutting which is what you’re going to end up doing and learning this course actually is how to shortcut because not only can you string a bunch of commands together and you solve it with the word pipe earlier but that’s the technique that we’re using the pipe input from one come in to you know go into output from one command going as input into another command so one of the one or two of the assignments is going to have you look with you know work with piping finding truncating stuff moving stuff creating directories and all sorts of different things kind of get you familiar with navigating through the UNIX system so the CP – are as an examples for recursive you know copy this and everything underneath it for this directed to the other directory and then we have short versions of it long options that are associated with it as well so we could say – R or we can say – recursive so people end up with their own style in terms of the way that they run these commands and because there’s more than one way of writing it and everything works theoretically if you type the command correctly so whose path is it anyway so I kind of alluded to this concept for you when I first brought up the terminal window and but UNIX treats a directory structure as a hierarchy of individual paths which is kind of interesting because if you took a look at this as an example I know well we got dead user home off a home I got B hacker right I got user I got been right it looks like Windows kind of doesn’t it most people argue with me for the first week or so and the guy yeah it’s just like Windows right if I mounted another disk in fact I have a USB Drive I can have to go dig through and find it it’s going to be in here at amount points into the directory structure but it’s a totally different disk so we have one global hierarchical structure that works and gives us our path in our environment but it spans over multiple drives multiple disk if you did that with a Window System well can’t do it with a Windows system yeah so if you have a hard drive on a Windows system you have files that are loaded on the windows hard drive if you take the hard drive out of the computer the hard drive has on it all of the files that you have stored on alright so theoretically one hard drive has one directory how does the directory span over multiple hard drives can but in UNIX you can have 20 hard drives you can have one directory with one file that spans over 20 of them so you can have larger files so you can have a video editing you know most of it’s done on huge back books or huge supercomputers with oh because Mac is BSD so you can have larger files you can have different features of the operating system they’re going to support different you know video streaming and capture and stuff like that you know problem right now with video cameras in a lot of ways is like you fill up your hard drive that’s not good so anyway long story short you can put in a USB Drive if I mount it in my USB Drive it’s going to show up in my directory structure just like any other director that would be on my hard drive but it’s not physically loaded on the same hard drive it’s on a different Drive so this concept of mounting and searching into the file system is completely unique versus the Windows system in fact I’m waiting for Windows to come up with this but they haven’t actually you can slip a USB Drive in on a window system see a little icon it shows up actually get this on the back as well icon shows up on this time you double click on it there it is there anybody on the UNIX system you can actually use a mount command mount it in the directory structure at a mount point read and write to that mount point and hopefully that drive is actually inserted because what ends up happening could take the drive out and the reading and writing to the mount point but there’s no physical drive connected anymore because they were accidentally removed it for some reason and then they lost our files actually but in that particular case hopefully you get some sort of an error this isn’t you know yeah you do get an error actually when you try to write it’s like right protected or something else I can’t write can’t save the directory listing but theoretically what you’re doing is you’re just adding physical devices into the same directory structure and I have one directory structure then the directory structure starts out with a global root so you log in a UNIX server you got root and then

you’ve got all a bunch of this so where they’re physically located who knows not all on the distribute it out or over five Sun boxes they’re not all one computer so and it’s just one of the biggest differences in terms of the directory structuring how its treated as a hierarchy individual paths so the directory you know what’s our working directory well actually I maybe even showed you that already with the PWD command so any LS command so if I typed in PWD it’s going to say you know what is my what is my working directory essentially so and this works Sarah say if I type in PWD well its users be hacker so if I have it well at the break I’ll find my USB but I normally do is I plug in the USB Drive and I go mount you know and I mount it into the anything we can see it in the directory structure and then I pull it out and I say well look at still in directory structure although it’s not physically connected you can actually do it in a read-only mode if you wanted to do it that way load it in take it away it’s still there because it’s in the directory structure not on the disk still is on the disk though anyway so LS is we’ve seen the beginning here that’s our first command PWD where are we to the directory structure which is kind of interesting because you sometimes you need to know because you might be doing some maintenance on another user count you might be in the wrong user account you’re deleting files and doing stuff you have no idea which is brings up a kind of another point about this mapping concept multiple users can be mapped to the same directory or the same section of the disk but have a different representation of it and we also the concept of symbolic links and different types of directories themselves that go way above and beyond the directory concept so Windows calls them folders needs to be called directories however in the beginning and then it turned them into folders they really are folders if you think about it in a Linux system Unix Linux their directories they’re not folders because you’re not sticking anything inside of the folder instead you have a directory map it’s same I kind of like a GPS directory it’s a route to get you to navigate through the system and it’s your navigational purpose so you can minimize the confusion for some users by mapping it differently so they’re really using the same files and they’ll say accessing the same programs but they have the appearance of them being in different directory names and there are different levels of the hierarchy as an example usually the user I have root privileges here on my computer but usually the user doesn’t get seen anything past home so if you have a UNIX account that you have let’s say for example you have a web I may have kind of people on their own web page as an example you can tell that into that UNIX server you’re not going to be able to see everybody else’s public HTML directory in fact you’re not going to see anything past your public HTML directory if you try to go back through the hierarchy it’s not going to let you its protection actually why should you be messing around somebody else’s files but there’s an admin who can go through all of it through there and their mapping will show everything yours is only on the show from public HTML forward whenever it is you create on that server well same thing here actually in fact if you downgrade your windows excuse me downgrade your Mac privileges put you back on a user you don’t see the dev you don’t see the user all you see is your home in fact you’re not going to see your home you’re going to see be hacker you’re being a cur so your get to see your home directory for your user you’re not going to see any of this other stuff so in UNIX we have different access levels so I’m going to go through this probably later after lunch you know the directory access file access rights and privileges that we can stick on and ways that we can configure the abstraction to make it easier to make it more useful in terms of the purpose what it is we’re designed to do and a stencil you know change mode command essentially and it’s done through system utilities to configure scripts to set directory locations and directory paths and so the PWD command will view that working directory that you’re in the LS command was set to list out the files that it is in your working directory finding your home well we can actually use this little squiggly line here or we can ask the environment variable what’s my home so if I did you know as an example I can you know in fact I’ll just come on the shell if I did the print B&B it’s going to show me everything but it’s going to show me your home or I can just echo echo this variable here and this one’s called home and I’m going to see this here and so well that’s my home directory you know switch to it if I wanted to or I could use you know CD space and I can get this little squiggly

line here goes be hacker oops if I spelt it correctly so I got a short pan that takes me back to home takes me back to a certain location and I can do most of your directory navigation is very similar with the DOS except for in UNIX we have relative and absolute paths so I don’t have to keep typing in the whole name of the directory I want to switch to I can go dot dot and so you’ll have an entire exercise actually on directing directory navigation which is actually kind of interesting we look at ego that’s going to be a pretty easy assignment right you’re just typing in you know change directory of the same granules you’ll see how complicated it actually kinda turns out because the exercise is going to have you go through a bunch of you know nan nan calm and yet very useful ways of navigating the directory structure here’s one here as an example the tilde character here hotel e well tell the shell to autocomplete the past statement so we don’t get this in like a Windows DOS environments totally unix thing or looking at the home variable the home environment variables there’s a lot of people that get set a bunch of variables you can do that if you want to remember your passwords you know it’s just a password variable and what to say I’m not such a good idea but if you want to like set a bunch of information that you know is in your environment go for it essentially it doesn’t really take up that much memory actually here’s some more file commands I’m locking in as I mentioned before I’m not going to go through each one of them would bore you silly but you can certainly welcome to try these out and take me to go to a terminal prompt type in see what they do not a bad exercise if you’re never seen the terminal prompt before which some students happens actually I changing the directory LS moving and v4 moving copy removing that comes in handy removing recursively as I showed you before actually comes in handy as well so you can get rid of a bunch of things all in one shot fact you can erase your entire hard drive easy just go to the root directory and remove the forward slash – are most system administrators would put a put a lock on that hopefully so that you couldn’t do that because you wouldn’t have privileges to do that hopefully if you’re the root however which is got an interesting thing so people from a Windows background everyone’s got the same privileges and ones got the same computer you know it’s my computer you know and actually most Union windows people only have one login that they use on their desktop well I have multiple logins anyway now although you can you can have like 20 different user accounts if you want more and they all have the same privileges yeah for the most part they have their different home directories and they have their different documents and settings and stuff like that but in UNIX you can have as an example admin level you can set profiles for groups of users so you can have groups of people who should not be allowed to recursively remove all of the files in the directory structure and you can have people who are not allowed to see the payroll program but they can see the HR program you can selectively configure the environment / user privileges and then set different profiles for groups create users assign them only have an exercise on that as well but assign users to groups essentially here’s our recursive directories as I mentioned before oftentimes the manual refer to the recursive actions or the directory so it means to perform an action on a given directory rather be remove update move works with all directories all actions and recursively do it to all sub directories it was interesting so you can’t delete you can’t Lily the directory that has a subdirectory with it unless you might be doing the – are recursively or remove everything inside it so then director is empty and then remove it just what’s that for a reason actually science in window you can actually click on the directory and then press Delete and removes everything for you it’s like automated so this is not automated Linux in UNIX wasn’t made for ease of use it was made for performance and functionality so a lot of the automation that we take for granted for in the Windows environment was there to help us made it made it easier for us to use the computer so you might be thinking well one of it well why don’t we want to learn the hard way of doing something well what if you’re working on a cloud you’re going you’re shelling your tell netting in you got UNIX you don’t have a Windows automation so you have to actually know you know how to actually navigate on a UNIX box if you’re going to do even if you’re not going to do system administration UNIX server stuff who knows maybe you want to be the system admin to here’s our relative and absolute path so you don’t really have this either you don’t have the dot dots and the dots although you see it which is interesting if we go to

dos and to see inside of the directory the dot dots at the top but you can’t navigate it well you can actually in some of the earlier some of the more recent versions of DOS you can actually because what ends up happening with dass eventually as they went well it’s not as powerful as UNIX and then it became more powerful then just keep adding more features under that so here we have a relative and absolute path just to explain that briefly here the commands that expect you to give give them a path essentially because we’re working with we don’t have just a file it’s not a file on a disk instead we’re navigating the directory structure and we’re moving something from one path to another I’m doing so so most of the commands will let you provide a file with a relative or what’s referred to as absolute so we have a relative and absolute in terms of the concept relative means in relationship with another directory so you’re in a subdirectory structure all the time unless you’re at the root so I’m going to type in everything all the way back to the root yeah you’re just going to change relative to something else when one point relative to that point you’re going to navigate absolute is everything all the way back to root absolutely everything so which is how you can sort of remember any relationship with another directory and relative purposes where you’re going to do it absolutely back to the beginning so so the dot dot forward slash directory is the dot dot refers to looking for in the previous directory first so it goes back to the previous directory or the dot single dot forward slash executable says say says this directory or the working directory you can actually use this when you run commands actually fortunately the environment variable is set in the in this particular actually see I should be able to lips how I got a little window out of that but then I should be able to use the dot and dot dots to run things as an example let me see if I have anything running here no I don’t have any executable files in here and there’s our all Android projects and stuff but if I had a C programmer a text file actually I could go dot forward and before I ran it and to say that I’m running this in this directory but I didn’t Anna was actually not in this directory I think I have a handle on here actually I do so and it was kind of like a text editor that comes with UNIX it’s sort of like bi I shouldn’t say comes with UNIX you can download it so we’ll go through that app get and downloading utilities and things as we get through the course but Deford a number one just showing you the command interface I think is a good start so the dot the forward slash is basically telling you in this directory run this file which is different because when I did that and I did this it didn’t run because it’s not in that directory which is a little different than the DOS days you know if it wasn’t a directory runs but you know it’s in my path so I have a path mapped to it so I know it’s going to write it’s actually probably in it’s probably off the roots actually it is is probably in bin yes nanos in there somewhere for those of you came in like we’re actually breaking it noon just about 20 minutes oops let’s see if I can get back to my neck trigger all right so the absolute and the relative terms of the directory wrapping so absolute or full pads are complete and he’s a way to know if your path is complete as you know it does it with a forward slash character at the beginning so so here we have a full path with the filename we have home user directory executable file it’s just going to be full stuff there’s a container character essentially it’s going to tell us whether or not we have that anything in there so poking around at home we can see how much space do I have by typing in quota and so the command itself to see quotas directories any if there are any actually I don’t know if I have any on disk quotas for be hacker none I don’t have any just go to set so what I can do is you know as I say for example I have a you know went out bought a $10,000 sudden server I decided I’m going to go into a SP business so webspace but I don’t want to give everybody five hundred megabytes or something now I’m going to be stingy with my web space I can set a quota for everybody saying you can only use five hundred megabytes and you can only use and then all of a sudden you’ve limited the amount of space each user can use so the quote is going to give you that ability to essentially look at it see how let’s see what’s going on how much space you have left I didn’t set a quota

I’m using my heart entire hard drive how much space am i taking up d you or DF commands will show you how much how much space a folder or directory uses DF if it’s been made for D you DF is gonna be the displays of space information for the entire system and if I run those I’m actually just try and make sure that they were actually work on the MacBook see ya so do you and Dia we’re going to kind of give me how much is this stuff taking it when I can see that disc s2 which is my main disk it’s like that 38% capacity too bad and then I see a bunch of these other ones and actually this is probably a good good example to show you is where you can see them mounted points so if I can find my USB Drive I’ll mount my USB Drive in here and I can see that I will probably have a hundred percent capacity left on it because it’ll be empty hopefully and I can see the mount point or coming in and I could probably put it on mount and then T directory or something and I’ll do that actually up to lunch and now I have to go find my USB Drive but long story short it will tell me for each individual device that’s in there as well for the mapping point how much disk space I have left so because it might be important because you don’t know you don’t see the disk you don’t have access to the disk only have ask access for is the information in the directory structure so you’re navigating it through the directory structure so helpful hints on space itself almost all commands and a deal with the space I will display the information in kilobytes or bytes so nobody finds really that useful so you can do it in human readable format which is the H so many commands will support the – H option for human readable which means well put in is something I can actually understand why I put it in bytes or something so LS – oh here we go displays the working directory files with a long listing format using human readable notation for space is not what we’re trying to do earlier so if we typed in LS – LH there we go now we can see how much space it’s wheel interesting routes on on routes actually how much space is being taken up by each one of my directories here and I also see more information as well I see the the privileges that are set for each one of the files and directories are set for the system so it’s in human readable formats all in columns that’s pretty good I think that was with the kemon we were looking for earlier actually yes see ya – LH give us at this space so in terms of representing space the bitee with one or the zero it’s going to be the bit the byte 8 bits I’m going to go through all this but go back to a computer science 101 you know the calculations of all of the different things only have to a terabyte per gigabyte terabytes permissions so the we saw actually a few minutes ago the permissions I highlighted it and I said this this this line here at the beginning is going to show us our permission so that the NX system multi-user system itself where many users run programs and share data well we have to protect it somehow so files and directories have three different levels of permissions they have the world when they have the public world group or user so this is three different levels types of permissions a file can contain might be and here’s an example here we saw ours and WS for reading and writing so file permissions are arranged by three groups three characters so we have three characters per group and there’s three groups so some of the extended versions actually have four because they have the other in there so in this example the owner can read and write a file while others have read access so we have read access for owner and then we have – – like they don’t have access or we have readwrite for owner routes along that write read and others only have NR and now we usually at the change mode command and this is just kind of I’ve got another lectures going to later on it’s going to go through changing things with numbers and changing things with characters and stuff but in this particular example we can do a change mod to change permissions on a file or on a directory and then a change owner to change the owner to another owner to another user both options support the – R as well for recursive recursion so we can recursively change the owner of a particular directory to somebody else if we do that then we can change and make it you know readwrite not readable not writable so we can share stuff as an example I’m inherence being hacker and

I’ve got a bunch of files that I wrote I want to share it with another user that’s on my system well I can change the permissions on the file or the directory and give them access to it or I can change the owner make it somebody else if I want to protect something I’m going to change the owner root I’m going to leave it in my root directory and take away access essentially to it so it allows us to customize the system a little bit make it so that people can run files but they can’t delete it or they can’t look at it but they can run it sometimes now we have information about ourselves we could type in Who am I and we can figure out you know I’m the current user we can change the password so most people who telling it into web sites to upload their files and use FTP you’re using a UNIX server by the way I’m also what you’re going to do is change your password eventually otherwise it’s set on the default you know how many people don’t change your password and just kind of it’s kind of funny actually a lot of people people do this with routers all the time I never seen password on a router so why I don’t know that you know you always know the default that they met here everybody else uses them usually can type in the default and it works yeah but it should also work here if I text in Who am I I can see that I’m be hacker so I can type in you know I don’t want to change my password but I could do that to change my password if I wanted to that would mess up my Windows system because I don’t know what my password is right now yes so what do we have here I just some samples bottom of the screen we could say what is my group support what is my group might be support group so it’s going to tell us the group here so if we change the group we actually would easy we could do things by groups we can just assign users to groups we have you know instant access you know you’re an HR person ok you’re an admin person profile them and give them access to certain things so what is everyone else up to so if you can go top show a detail refresh description of the running processes on the system up kind this example of time on my computer or well I’ve had it up but mmm two hours hmm okay well we’ll talk it up today so it hasn’t been up that long okay um I can type another you know to figure out top yeah that’s running on this system and I can figure out well ok this is all this stuff and I can see it right here changement of the load isn’t very similar to going into the Windows and what is it not the control valve a I could control alternate delete what does that bring up the task manager yes task managers I was thinking up and as seeing the real-time activity but this is a graphical so there’s also gooeys that are built to show you that stuff we could type in PS and see the processes that are running jobs it’s also supported I don’t have any jobs running as a user PS and all jobs has been showing what my jobs are but I do not have anything running and we can run programs in the foreground we run it in the background we have a an assignment as actually run through that for you as well actually the first assignment that does the shell is going to go through all of that stuff so you’ll be writing you’ll be writing your own shell essentially and your shell will have a the ability to run programs in the foreground and in to the background as well so so uptime the load as well so the load is the number based on a utility the CPUs of the system so a mode of one indicates full load once CPU I didn’t look at it but if you have multiple CPUs it’s going to show it to Percy for you as well so in terms of working with programs I showed you to the PS to show you the running processes our own system and in jobs shows you processes that are running per user and jobs is actually not supported on all Linux builds that PS is that’s the standard Universal processing system so commands for programs on the system itself is identified by their file name and their process ID if you go into the task manager and ya click on let’s say you opened up Windows Explorer several times internet explorer several times and one of them crash Microsoft Word or something this is would be the equivalent of typing in PS and if you double clicked on it and said kill or not kill unix would call it a kill if you double clicked on it said you know remove stop it now take all these word hyped-up twenty words opened up you know let’s close them all you’ve ever done that it’s equivalent to the UNIX command kill so everything that you can do on a Windows by actually can do on all an Xbox but you can do it better because you have more control over it you can kill it now you can kill it later you can kill it at certain priority you can go processes that don’t belong to you if you’ve got access to it which is what system administrators do so they go in

and say this users been running this oh it’s a virus let’s just kill it or something so so the ps/2 displays the process information on the system kale PID kill this process ID terminates the process by its ID control C may also terminate program as well as we’ve seen a couple times control D terminates your session gets rid of your session why do you want that well we’re working on a process system so UNIX is true multi-threaded processing environment so as Windows but UNIX users as well as developers have more control so we can go in and look to see what processes are running what kind of system will they’re taking up we can selectively stop them start them run multiple processes if we want to and every time we open up a session we’re taking up resources every time we open up a process for taking up resources so a system administrator would go in and control the use of the CPU and you know if someone is not working fairly and someone is like here’s a big batch job well you just pause the job or you put it in the background put it in the foreground and you move things around so a lot of the system administrators job is to control the processors you know what’s going on and make sure everyone’s got you know usable environment to work in so only news or the super super user a root cause permission to kill processes you own so you just can’t go in you don’t have root privileges you can’t go in and just kill everybody else’s processes in fact for the most part me you won’t even know what’s running on the computer you know you have a lot you’re at your session is your session what else that processors being used for you don’t know but maybe hopefully the the root user it is advanced program options so oftentimes you must run a command in the background so you can use the ampersand here ampersand character following the command will put it into the background do we have a foreground and background processes and Windows we do actually the minimize yeah when we open up NIT and for the longest time we didn’t have that actually windows 3.0 didn’t have it I don’t think it had it I’m not sure but every time you switch windows everything you’re not working on is in the background whether it runs slower or not is a good question I’ve never actually tested it but in the linux environment you can actually give you can adjust it so background processes aren’t taking up as much CPU CPU utilization so if you have let’s say a backup if that can run all day so put it the background don’t give it so much resources so it doesn’t affect the user environment I don’t believe you have the ability to do that on a Windows box Adan you can put it in the background but you can’t tell don’t eat up any resources right now I’m trying to print something out now or you can assign a lower priority yeah this is essentially what you’re doing with multiple threads in the linux environment is from signing priority essentially you’re giving a lower priority to the background you can do that on a Windows box yeah I’m not a huge Windows user as I was just I was curious I’ve never tried to lower a priority on a process I don’t think I can I know the task managers got a bunch of features and a lot to look that up that concept being you know not having it eat up all your resources that’d be nice actually for those Windows updates I’d like to turn them off anyway so I don’t I don’t do the I’m not a huge windows fan anyway and let’s not talk about Windows his UNIX course let’s talk about UNIX instead all right so the here we have the command with the options here it goes to run in the background we can match zero more characters with wildcards same thing we do in that dos actually using a CP space an asterisk as a wild-card to a destiny copy everything basically what that’s going to tell you option gets you in trouble if misused obviously delete star dot star four slash R minus R has delete everything recursively I don’t think you’re going to be allowed to do that actually I hate the VI and I never use it why it’s just not user friendly to me so I usually opt for another one called Nano which is kind of the same thing but it has like a little graphical thing you wondering why in the world it’s kind of like the notepad equivalent to Windows but notepads GUI bi is not GUI neither is Nano actually it’s a text base why are you doing that well if you’re out at a command prompt you’re writing a script and you want to edit the script believe it or not it’s actually easier to bring up a text editor than it is to exit out of the command prompt window go back and open up a notepad a graphical user edit err to go in and change something sometimes it’s just a little bit easier to actually edit it from the command prompt so people still

use VI today because of that reason actually um you still use pika much as Nano he goes nano version I the more current version of it’s called Nano actually editor originally used for an email client pine pine actually still exists I think I actually even have pine on here where you can send and emails text space from instead of going into Microsoft Outlook or something to Eudora or you know Thunderbird or one of these mail programs you just done from the command line so you can use Nano and write the message and then actually send it from nano so it’s a quick way of sending a message out you might be wondering why would I want to do that I can just open up Microsoft Office and say here’s the Outlook Express reuse outlook or whatever and it’s a much better experience right what if you’re writing a script after a backup that runs in the middle of the night you want the script to send the email message out with the message with the error message that actually occurs at the time that it actually occurs well then you put it in a script and use Pico or you use Nano and you actually send it out on a command line prompt automated so a lot of this stuff here especially you know editors email clients telnet FTP pinging all these tools that are like you know people go oh so low-tech it’s like command line they’re actually higher tech not low tech they’re better than the GUI because you can put them into scripts and you can automate with them so you can send messages in and out you know without ever having any user involvement at all which is what admins do especially be writing your own scripts and you’ll get the opportunity to write some scripts in this course as well in fact one of the programs has you send out you know spam message to like 500 people or something like that you certainly wouldn’t want to do that with a GUI would be too time consuming to take you all day to write it to send all those messages down so but I command lines like accidentally can send it out to hundreds of people with a few statements got a command line and all someone’s got junk mail which is what most of your spam mail is actually doing so nobody manually sends that stuff out there’s a script that sends it out input note but we’ll else take a look at this in the redirection of i/o which is kind of interesting you know at the beginning when I started out this lecture several hours ago we’re not too long ago I started out talking about sessions and how we have our own telnet now we have a window that opens up terminal the interesting thing is it’s just nothing more than the input the output from the UNIX box we have many different users that have many different forms of input and output so programs commands I’ve actually programs themselves have their own input both programs can actually act like BOTS I’m going to do box BOTS you can they have their own input and output they have their own functionality or users but they’re just not really the source so so they can contain input and output they are called streams in the UNIX environment so UNIX programming is often referred to as a stream based interface so we have the input stream the output stream so programs often have air as well so we can and one of the things that system admins do all the time is they redirect the air output to a file my store and you can archive it and they can make logs like Innes you know two seconds you can create your own logging system for everything in fact you can actually log everything a user does system in about two or three different lines of code written in a script so you can have it on your UNIX box see what so-and-so is web surfing at lunchtime or something yeah but well by copying the output or the input actually redirecting it or by just logging in essentially and then also log you know there’s good – it’s not just for spying on people people will capture the errors just to see what’s going wrong the system it’s standard in and you can actually you know use it this is just because this goes back to C programming actually the standard input stdio.h which is standard i/o and standard input or the output from the keyboard stsd the standard output and standard air that’s a typo actually on that so standard input standard output standard errors but that’s supposed to be this is a type of a team the D needs to be moved around but have to fix that for next time standard understand and input seven out but going back to C programming 101 if you’re not a C programmer actually if you are C programmer you understand your next a lot better actually because a lot of the stuff is C based as well so as we know that from the beginning you’re not a C programmer and you’re brand new to computer science then UNIX it’s kind of going to be a little bit overwhelming I believe to some at first but it doesn’t take you that long in fact I personally think it’s easier to learn than Windows

but I’ll see file redirection so often times you want to save the outputs from a program so that’s nice and you’re in a Windows system right you double click on something you got the GUI and you’re looking at it it does something and you can see the output right but what if you’re not there or what if you don’t want to see the output what do you have a program running in the background then you can save the output redirect it to a file and look at it later after it runs maybe it’s doing a virus scan so most of your virus scanning software is not going to show you in real time what it’s doing instead occasionally it’s got put a little pop-up message comes out of nowhere hey detected this file or someone’s trying to come in on this port it comes out of nowhere well it’s still logging the information it’s redirecting it to a different source and then all of a sudden it puts it up when you need to see it so you can do this in Linux by yeah or UNIX by it’s done with a redirection operator and this is the input and the output arrow actually so just kind of show you something real quick here if I ran a program I use the directional arrows and these are these are the arrows I’m talking about here this arrow and this arrow to take something from this file and send it to that file or take something and write it from here and send it to that so if I did an LS as an example I can go LS and then I’m going to output output it to and this is like the C&C out if you’re familiar with C++ actually three directional arrows I’ll put it to my list access to our permission denial that’s nice it’s probably cuz I’m enroute the same so where am I I am I mutt in my user account so I’m going to go users I’ll probably do it here and actually I’ll just go back to be hacker here we go so now if I go LS and I see out to my list nothing happened while I redirected it and I did so if I typed out or if I cat my list which is a way of typing it to the screen I see my list it’s stored in a file but it was really my output and it’s using that arrow here if I actually can see the history of my command by just pressing my up and down arrow or I can actually look at the history because that’s all logged as well as as I mentioned before we can use this redirection to spy on people well this is kind of a spying on me all those commands I just did a few minutes ago or all stored in here but that’s on purpose is my history from my shell my history actually stays so and we have an entire lecture I’m looking at the history in fact you’ll have an assignment actually that’ll have you go to different places in the history and rank commands over again instead of having to retype it again because why do you want to retype everything every time you’re going to run something but going back to this command I just ran it was this one here and that actually might look familiar it’s like you know the I same operators that we were using redirection on and see out see and take stuff in put stuff out on the standard input output which is the same concept it comes from C by the way so so my program and then to a file name uses it to redirect the output to my program which is going to be the file name so and seminar we can append the output to files instead of rewriting it so we can append with this so that should look familiar for people who use C++ C n NC out confectional says appended so we’re going to write it out we’re going to penned it out instead of rewriting it over writing it as a yeah promised I was going to I was actually going to have a lunch break at noon and I have like 50 slack I like time I I’m not as far through this lecture as I wanted to be and I just I’m you probably are getting hungry and I promise I don’t break my promises so I’m what I’m going to do is kind of end this lecture and then we’re not done with it they’ll pick it up after our lunch break and give you guys a break at least for something you have to go to the bathroom or something and I like to talk for more than a couple hours anyway so I’m going to take a break you guys are going to take a break and he came in late make sure this is the TA over here she said which one’s your stay never cracker she’s our TA she has sent out so actually here let me stop this video real quick and then I’ll give you the administrative stuff so this is part one of lecture one and just so you know I’m recording this all you can’t see it I’m actually recording it so if you happen to miss something you can come back and look at it but don’t leave yet I’ve got some announcements to make