Welcome to the learn Linux in five days course on day one you'll learn what Linux is how it came to be and some of its strengths and weaknesses you'll also learn a few different methods to gaining access to an already installed and running Linux system if you want to learn how to install Linux on your own don't worry you'll learn how to do that too finally on day one we'll talk about the various Ways to connect to a Linux system and the software you'll need to do so you'll start out day two by learning about
the Linux directory structure and where various components of the operating system reside next you'll get an introduction to the Linux command line interface and learn some of the most essential and often used commands even the most experienced Linux users need help from time to time and you'll learn how and where to find that as Well you'll also learn about the super user account why it exists and when you need to use it you'll wrap up day two by learning some directory shortcuts and how to navigate about the file system day three will include lessons on
file and directory permissions you'll learn how to read permissions what they mean and how to set them you'll also pick up some tips on working with groups and the permissions you should use when doing so next you'll learn two commands that will Help you find any file or directory on a Linux system you'll learn how to view the contents of files and how to edit them we'll also cover commandline editors as well as editors that you can can use in a graphical environment you'll start out day four by learning how to delete copy move and
rename files and directories you'll tackle input and output redirection before learning how to compare the contents of files and Directories next I'll show you how to search for data within files you'll learn how to customize your command line shell prompt to your liking and learn how to use aliases finally on day four you'll learn how to transfer data between your local operating system and and a Linux host you'll even learn how to copy files from one Linux system to another on the final day you'll learn how to examine and manipulate processes And jobs you'll learn
how to automate tasks and make them recurring events we'll talk about how to switch between users on a Linux system 2 you'll also pick up some tips that will greatly speed up your workflow at the command line finally you'll wrap up the course with learning how to find install update and remove software in today's lesson you will learn what Linux is where Linux came from what a Linux distribution is and some of the Reasons that Linux is favored for certain applications and projects over other operating systems first and foremost Linux is an operating system an
operating system is simply a collection of software that manages Hardware resources and provides an environment where applications can run the operating system allows applications to store information send documents to printers interact with users and other Things Linux is also a kernel typically when the term Linux is used it refers to the Linux operating system as a whole however it can refer to just the Linux kernel as well the Linux kernel is the core or the heart of the operating system it's the layer that sits between the hardware and applications set another way it's the intermediary
between softare Ware and Hardware however to have a useful operating system you need other components in Addition to the kernel these components can include system libraries graphical user interfaces email utilities web browsers and other programs lenus talts created Linux when he was a student at the University of Helsinki studying computer science and early 1991 he purchased an IBM compatible personal computer that came with the MS DOS operating system Lena wasn't satisfied with MS DOS and wanted to use a Unix operating system like he was accustomed To at the University when he set out to obtain
a copy of Unix for his personal use he found that the least expensive Unix he could buy was about $5,000 driven by the desire to run a unix-like operating system on his personal computer he set out to create Linux lenus and over 100 developers worked on Linux over the next couple of years and in March of 1994 version 1.0 of the Linux colonel was released Linux is opsource software this means that Anyone can use copy study and change the software in any way they choose so long as the source code is openly shared with others
to date thousands of people have made improvements to Linux and with Linux being free and open source software it has led to the rise of Linux distributions in every case the source code is free but in some cases the distribution is not free the binaries the compiled code is not free for example you have to pay a license in Order to run Red Hat Enterprise Linux however Red Hat releases their source code for anyone to download again Linux is not a Unix derivative It Was Written from scratch however many of the commands that are found
in Linux are also found on Unix if you have any experience on a Unix system you're going to feel right at home on a Linux system a Linux distribution is the Linux kernel and a collection of software that together creat an operating system each Distribution has its own goals and areas of focus your choice of distribution will depend on what you are trying to accomplish there are distributions that are commercial these commercial Linux distributions are backed by corporations and you can buy support from them there are non-commercial Linux distributions these are maintained by a community
of volunteers you have Linux distributions that are designed for Server use others that are designed for desktop use some That are focused on research and science there are others that are focused on multimedia production there are literally hundreds of Linux distributions distrowatch.com is a great website to learn about all the available Linux distributions drro is short for distribution on your screen I've listed some popular Linux distributions Red Hat Enterprise Linux Fedora Ubuntu Debian sus Linux Enterprise server open sus Linux Mint again there are hundreds of These these are just uh a few of the most
popular Linux distributions to get an idea of exactly what's available go to distrowatch.com so what are some of the reasons you would want to run Linux Linux runs on many Hardware platforms from dedicated networking devices to phones to personal computers and even supercomputers proprietary Unix operating systems typically only run on their Hardware from their company For example hpu only runs on HP servers ax only runs on IBM servers Linux can run on HP IBM and other servers Linux was developed on PC Hardware using Intel processors over time Linux has been ported to more Hardware platforms
than any other operating system the small footprint of Linux allows it to run on older Hardware or on embedded systems also Linux is known for being stable a able reliable and secure this makes it a great choice for servers that Need to continuously run without downtime Linux has traditionally been used for Server applications Linux can be used to host websites act as file servers and even run database software Linux doesn't have to be used as a server though I find Linux to be a good everyday operating system that I use on my personal desktop as
a matter of fact I'm recording this course with software that is running on Linux l Linux is free not only is a Source code freely available but you can run Linux on your Hardware without having to pay a licensing fee in many cases however if your business depends on servers that are running Linux having a commercial Linux distribution which you pay for and having someone that can provide support can be well worth your while Linux is typically not as costly as the proprietary Unix operating systems Linux is also free in the sense that you can
use it for any purpose and You can modify it to fit your need if you so desire there are also many free software applications that run on Linux many of these free applications were written specifically with Linux in mind let's recap what we've gone over in this lesson first we learned that Linux is an operating system when someone says the word Linux without a qualifier more than likely they are talking about the entire operating system however Linux is also a kernel when people speak of the Linux kernel they're typically specific and say the Linux kernel
Linux being the operating system is the intermediary between hardware and software Linux distributions are implementations of Linux each Linux distribution has a different goal and a slightly different Focus your choice of distribution will be driven by the goal you are trying to accomplish in this lesson you're going to learn what a Linux distribution is What the most common Linux distributions are and how to choose the right one for you generally when someone uses the term Linux they're referring to the Linux operating system as a whole an operating system is a collection of software that manages
Hardware resources and provides an environment where applications run the operating system allows applications to store information send documents to a printer and interact with users for Example a Linux distribution is simply a collection of software and applications bundled together and distributed as a single operating system for example one Linux distribution might come with one particular web browser installed while another Linux distribution will come with another web browser installed by default you'll be able to browse the web on either distribution but the specific piece of software used to do that might be Different it's important to
point out here that the software that comes installed by default can be changed if you don't like the web browser that shipped with the Linux distribution you're using you can install another one and use that one you can think of a Linux distribution as a curated collection of software that works well together but you're more than free to use the software and applications that you like best before we continue I'd Like to point out that you'll often hear the term distribution shortened to distro also some people refer to the various distributions as flavors what every
Linux distribution has in common though is the Linux kernel again typically when the term Linux is used it refers to the Linux operating system as a whole however it can refer to just the Linux kernel as well the Linux kernel is the core or the heart of the operating system it's the layer that sits between The hardware and applications set another way it's the intermediary between software and Hardware however to have a useful operating system you need other components in addition to the kernel these components can include system libraries graphical user interfaces email utilities web
browsers and other programs to summarize a Linux distribution is the Linux kernel and a collection of software that together create an operating system by far the Two most popular Linux distributions used in Information Technology departments and by Linux professionals are red hat Enterprise Linux and a buntu so if you plan to use Linux in your current or future career as a Linux system administrator Linux systems engineer or even a database administrator or software developer then I highly Rec recommend focusing on these two Linux distributions you can forget about the literally hundreds and Hundreds of Linux
distributions and choose between red hat Enterprise Linux and auntu if you want to work for large traditional organizations like financial institutions Transportation companies telecommunication corporations large retailers and healthc Care organizations then you should choose red hat by the way to run Red Hat you need to pay for a license however if there's really no need to pay for a license if you're going to be running Linux at home or Want something to practice on instead use Centos which is a red hat Enterprise Linux derivative that's completely free it's really red hat with The Branding and
logos replaced with cintos branding if on the other hand you want to work for a startup or smaller more Nimble web-based companies like software as a service type businesses social networking sites smaller e-commerce stores or practically any company that relies heavily on cloud computing then Auntu is the distribution for you if you're using Linux strictly for fun for personal projects or just want to see what other distributions have to offer feel free to try out some other popular dros like Linux Mint Debian magia Fedora open soua Arch Linux and slackware when choosing a Linux drro
for personal use it mainly comes down to personal preference and if you like most of the software that comes installed by default of course don't forget about cintos and Auntu they make great dros even for personal use ultimately Linux is Linux at the core no matter which choice you make the Linux concepts are going to be the same sure each distribution is going to be a little different but if you can do something on one distribution you'll most likely be able to figure out how to do it on another what this really means is that
you can't make a wrong decision know that by simply choosing a Linux distribution any distribution you've Already made the right choice to recap a Linux distribution is the Linux kernel and a collection of software that together create an operating system the two most popular Linux distributions used in the industry today are red hat Enterprise Linux and auntu if you want to gain Red Hat experience without paying a licensing fee then use cintos as it's really red hat with a branding and logos replaced with cintos branding This video is for Windows users only so if you're
using a Mac go ahead and Skip ahead to the next video first let's open up a web browser and visit virtualbox.org next find the link that takes you to the download page currently that's downloads we'll click this here from here select the file for your platform which is Windows so we'll click on the link next to Windows hosts once the download is complete we can Click on the file to begin the installation process the installation is fairly easy we're simply going to accept all the defaults and answer yes to all the questions so here I'm
going to go ahead and click on next again I'm going to accept the defaults by clicking on next the defaults are fine click next yes and finally I'll click install again whenever you're prompted Go ahead and click on yes at the end of the installation clicking on finish will start virtual box okay the virtual box application started so the installation went correctly to start virtual box in the future there's a couple of ways you can do it one you can click into the search bar and simply start typing virtual box then you'll see the option
in the search results so Oracle VM virtual box another way you can find it is by clicking on The Windows button and then navigating to it and in this method you want to make sure you're looking for the full name of the application which is Oracle VM virtual box so here you see an oracle VM virtual box folder so we'll click in there finally you'll see the application itself Oracle VM virtual box and that's how you would start it in the future next let's install a program called called 7zip to do that we'll Visit 7-zip.com
loads to go to the full download page here I'm just going to click the download link next to the 64bit file we'll click that and make sure that that downloads next we'll click on it to start the installation we'll click on yes here again we're going to accept the defaults just like we did with virtual box now the installation is complete and we can click close in an upcoming video You'll be asked to download and extract the contents of a compressed archive file you'll do that with this 7zip program that we just downloaded here's an
example of how to do that I have a file downloaded that ends in7 Z I've navigated to that file using the Explorer it's in my downloads directory here now I will rightclick on the file go to the 7zip submenu and then click extract here you'll see that a new folder Appears and it has the uncompressed version of the file in it so I'm going to double click in there and now you can see that it has a file there now you're ready to install Linux in a virtual machine using virtual boox this video is for
Mac users only so if you're using Windows skip ahead to the next video the first thing we're going to do is open up a web browser and visit virtualbox.org Next find a link that takes you to the download page from here select the file for your platform which is Mac so we'll click on the link next to OSX hosts once the download is complete will go ahead and click on the file to open it now we can double click on the virtualbox PKG file to start the installation we're going to click continue and we'll click
continue again and now we'll click Install f it prompts you for your password go ahead and enter that the installer reports that the installation was successful so we can go ahead and click on the close button now that the installation is complete you can start virtual Box by using Spotlight press command space or click the magnifying glass icon in the upper right hand corner of the menu bar to bring up the spotlight search bar from here simply type in Virtual box and press Return you you can also start virtual Box by opening up the finder
navigating to the applications folder and double clicking on Virtual box there next let's install the unarchiver the easiest way to do that is to open up the app store let's start spotlight Again by clicking on the magnifying glass icon in the upper right hand corner of your screen or Again by pressing command space so now just type in app store and press return next what we want to do is search For the unarchiver that should bring up a list of matching applications now simply click on install under the unarchiver and enter in your password if
you're prompted to do so in an upcoming video you'll be asked to download and extract the contents of a compressed archive file you'll do that with the unarchiver here's an example I have a file I downloaded that ends in 7z I've navigated to that file using the finder Now I'll just doubleclick the file and the unarchiver will extract the contents of that file if we navigate into the folder that it created you can see that the uncompressed file is in that folder now you're ready to install Linux in a virtual machine using virtual box the
first thing we need to do is download a Centos vdi or virtual dis image open up a web browser and visit Linux trining academy.com Svdi click on the Centos 7 vdi download link this is a rather large file so this will take several minutes to download Once the download is completed we need to extract the contents of the archive first you're going to navigate to the folder where you save the download this is typically your downloads folder I'm on a Mac so I'm just going to double click on the archive to extract its contents remember
that this process was covered in an earlier video one for Mac Users and another one for Windows users once the contents of the archive have been extracted you'll notice a new folder you can click on that folder and you'll see one file in that folder and we'll be using that in just a second so now that we have our virtual dis image downloaded and extracted we'll start the virtual box application now will create a new container or virtual machine for our Centos operating system installation by clicking on new you can see here that It asks
you for a few bits of information the name the type and the version I'm going to name my virtual machine Centos desktop as I type that in Virtual box automatically selected Linux as the type and red hat as the version if it didn't we could simply use the drop- down boxes and make the appropriate selections so once we have our name our type and our version set we can click on continue the minimum amount of ram Recommended for cnos is 1,24 megabytes or 1 gab I have plenty of RAM on my system so I'm going
to dedicate about half of my resources to this virtual machine so I'll use 8,192 megabytes or 8 GB next we'll click on continue on this screen we want to click on use an existing virtual hard disk file now we're going to click on the folder icon and navigate to where we downloaded our disk image and here it's In my downloads folder and then we can click on the folder that extracting the image created and then finally click on the vdi file or the virtual disk image file itself and click on open finally we just click
on Create and now we have a virtual machine for Centos now we just need to start the virtual machine we make sure the virtual machine is highlighted by clicking on it and clicking start at the top of the screen or you can even right click the virtual Machine go to the start menu and do a normal start either way is just fine so now we'll just let Centos boot up once cintos has booted up you'll be presented with a l login screen to log in as the admin user just click on the username and then
enter in the password for that username which happens to be admin user as well and click sign in by the way the username and password for the system will be supplied with the disk image so if you happen to use a Different disk image look for the username and password combination that works with that particular image the first time you log in you'll be asked a couple of questions to complete complete the setup for the account here you choose your language mine is English which is selected and I'll just click next next select your keyboard
the default is English and so that works for me I'll click next and then finally you can connect your online Accounts which I recommend just to skip at this time click Skip and then finally it says you're all set you can start using cintos now so just click on start using Centos a getting started screen pops up and you can watch these videos and read some of the documentation here to get an IDE aide of how to navigate your way around the Centos system at this point we can see that everything works so I'm just
going to go ahead and shut down the system first I'm going to Close out of this getting started screen next I'm going to go to the ight corner and click there and then I can click on the power button and then from here I can choose to restart or power off and I'm just going to power off now you have a Linux installation to use to complete this course as well as PR practice your Linux skills I want to go over some common issues that might arise when working with virtual box the first issue I
want To talk about is antivirus software some Windows antivirus software such as a Vera AVG and others have been known to interfere with the operation of virtual box I've listed some errors on your screen here that can be associated with this type of issue if you get such an error when starting a virtual machine try disabling your antivirus software and rebooting your system here's a screenshot of one such error again the workaround for this is to Simply disable The antivirus software or switch to another antivirus software that doesn't interfere with virtual box if you happen
to have a Mac you could use it for your coursework as most of the issues we'll be talking about here are windows related in some way if you see an error in your virtual machine window that says something along the lines of this kernel requires an x86 64 CPU but only detected in i686 CPU then you need to enable the Virtualization options in your bios this means making sure that you have VTX for Intel processors and amdv for AMD processors enabled this varies from manufacturer to manufacturer so you might have to look up the documentation
for your specific computer another thing thing that can cause the this kernel requires an X 8664 CPU message can be that you've selected a 32bit processor in Virtual box itself in this case the error message really isn't talking about Your physical processor but the virtual processor that it sees go into the settings of the virtual machine you're having an issue with and make sure you've selected a 64bit version for whatever Linux distribution you're using for example if you're using cintos select Red Hat 64bit because Centos really is Red Hat just without The Branding if you're
using a buntu make sure you select a buntu 64bit etc finally I want to leave you with one Last troubleshooting step which is to Simply reboot your physical computer and try again there's a chance that something is not functioning properly that isn't immediately obvious to us when it comes to troubleshooting our local systems this is a relatively quick and harmless thing to try the next video demonstrates another method for installing Linux if you already have Linux installed using the virtual dis image with virtual box then You can skip the next video the method you'll learn
in the next video can be used to install Linux directly on physical Hardware or it can be used to install Linux with another virtualization system such as VMware hyperv Parallels Desktop for Mac KVM and others you'll also want to use that method if you want to customize your install for example if your first language isn't English you may want to add additional language support for your Native language perhaps you want to install some additional software or maybe you want a really minimal install and don't want to install a lot of software many of these things
can be changed after the initial installation but sometimes it can be easier to start out with a system exactly the way you like it than it is to modify an existing system again if you already have Linux installed and running in Virtual box you can either watch the next video to see What a manual installation looks like or you can skip it all together either choice is fine at this point you should have virtual box installed for your operating system the next thing we're going to do is download cintos from sos.org or we'll click on
the get Centos Now button or whatever the link to the download section of the website happens to be at the time you watch this video you'll notice that you have a few options here The DVD ISO is perfect for what we're about to do this DVD image contains all the packages that can be installed using the installer so we're going to click on DVD ISO to download that go ahead and pick a mirror and click download there save the file I'm going to go back to the previous page and let's talk about the everything ISO
and the minimal ISO so the everything ISO contains the complete set of packages for Centos you Would use this image if you wanted to create a local mirror of Centos packages for example finally the minimal ISO will allow you to install a very basic Centos system if you use this image it won't install a graphical user environment if you wanted a graphical user environment and almost any other type of software you would have to install it manually after the initial OS install so again the best choice for us is the DVD ISO once we have
our ISO downloaded we're Ready to create a virtual machine go ahead and start the virtual box application now we're going to create a container or a virtual machine for our cintos operating system install you can see here that when I click the new button it access for a few bits of information I'm going to name my system cintos desktop as I type the name of my system in Virtual box detected that it was Centos and so it automatically selected Linux as the type and red hat as the version now this is what we want when
we're doing a cintos installation now remember that cintos is a Red Hat Linux derivative so that's the version we're going to tell virtual box that we're using IF virtual box didn't automatically select the type or version for you you can simply click on it and select the type from the list which again is Linux or the version here which is Red Hat 64bit going to go ahead and click continue and Go to The Next Step here it's saying the recommended memory size is 1,24 megabytes which is 1 gab you can see that in my system
here I have 16,384 megabytes or 16 GB about and so I'm going to dedicate about half my resources to this virtual machine so I'm going to use 8192 and so if you have say 4 gig of RAM maybe you could devote 2 gig to your virtual machine Etc so we'll click Continue to continue and what we need to do now is create a hard dis a virtual hard dis for this system go ahead and click create at this step you want to choose the hard disk type we're going to leave it at the default a
vdi a virtual box disk image at this point we have two choices one is dynamically allocated and the other is fixed size if your primary concern is about preserving disc space or using as little disc space as possible choose dynamically allocated However if you're looking for better performance use fixed size I'm going to go ahead and use dynamically allocated press continue here and now we need to specify a size for our dis I'm going to specify 100 GB for my hard drive although 8 GB is sufficient to install Centos to I like having some additional
space so that's why I'm going with a larger size so we'll click create so now we have our virtual machine next we need to install Centos So let's power on the virtual machine to do that you can either click start at the top or rightclick and press start like I'm going to do I'll do a normal start now it's going to ask us for a dis image to boot this system from and what you want to do is click on the folder icon and navigate to the location that you downloaded the ISO from sos.org so
I'll click on that and click here and click open and now we'll hit start to boot the System you'll notice that you have a couple of options the check media and install cnos is highlight Ed what this will do is make sure that the image you are using isn't corrupted the iso image that you downloaded from sos.org I recommend going with the default here so press enter to start the installation so I'll click inside the virtual machine and then press enter you'll see that the system starts to boot and then it starts checking the Media
or the iso image that we're using to do the installation here is the first install all screen there's a button at the bottom of this installation screen that I can't even see I want to make sure that I see everything that Centos is showing me so I'm going to put this virtual machine into scaled mode what this will do is fit the virtual machine screen inside my virtual box window so I can make the window as small or as large As I want and I can still see the entire screen of the virtual machine since
we've already clicked inside the virtual machine window the virtual machine has control over the mouse and keyboard so anything that I type or any Mouse movements that I make are going to the virtual machine to get control back to the host system we need to press the host key which is a special key reserved for virtual box actions by default the host key is the left command key on a Mac and on Windows it's the right control key even if it's something different you can always tell what the host key is by looking in the
bottom right of your VM window I'm on a Mac and so you can see that left followed by the command symbol is displayed in the bottom right of the VM window when I press that designated host key the control of the mouse and keyboard are returned to the host computer I'll do that now now I can go to the view menu And select scaled mode on a Windows system you'll go to the view menu that is in the menu bar at the top of your VM window and select scaled mode virtual box will tell you
how to get out of this scaled mode if you want to it says Press host plus C and it tells you what the host key is currently set to I'm going to go ahead and click on switch to switch to scaled mode now I can see the entire screen of the virtual machine in my window so now I'm just going to increase the size of the window so I can really see what's going on inside the virtual machine at this point I'll click in the virtual machine and now the virtual machine has control of my
mouse and keyboard so now I'm just going to Mouse over the continue button and click to start the installation on this installation summary screen we can go through each item if we want and make some changes for example the date and time is set to America's New York for me if you wanted to change this you would simply click on that and then select your place in the world and then and click done so I'm just going to leave it as America's New York and I'll click done and again the same thing with the keyboard
and the language support the one thing that we really need to change is the software selection so make sure to click on this so what we want is a graphical user environment so let's click on gnome Desktop here and then there are some add-ons to the right these are optional however there is one that I want you to click because we're going to be using some of the software that gets included there in just a few minutes minut so head on over to the right side of the screen and make sure that the development tools
are checked so when we've done that we'll just go up here and click done and then the installation destination we'll click on That and then you can see that it automatically selects our virtual hard disk so when we're doing this installation it may say that we're going to overwrite everything on the hard disk well it's going to overwrite everything on the virtual hard disk and that is just fine so everything looks good on the screen there's nothing to change you just need to go in here and confirm so we'll click done so now it gives
us the option to Begin installation and that's what we're going to do we'll click that button on this screen you can do two things here the first thing is set a root password which we'll go ahead and do we'll click on that and then you're going to set a password for the root account and we'll be talking about the root account later in this course so so just go ahead and pick a password and be sure to remember that password and then we'll click on done Now if you choose a weak password it will make
you press done twice to confirm that you're going with a less secure password so in any case we'll click done so now we have the option of creating a user and we want to go ahead and do that as well so we'll just Mouse over to the right there and click on user creation so here is where you'll enter your information for your personal account on This system so I'm going to enter my name and you want to make sure that you check this box that says make this user administrator checking that box will make
it easier for you to do things on the system such as install software and do other kind of administrative tasks like that we'll be covering that later in this course as well so now we need to supply a password and then that's all we need to do on this screen we'll click done and then We'll just wait for cnos to perform its installation now that the main installation is done we need to go ahead and reboot the system and finish up the installation so I'll go ahead and click on the reboot button now when the
system first boots you may need to accept the license information so right here we just hit one and press enter and now we'll enter two to accept the license agreement and now we just press C to continue and then now that The license information has been accepted you'll see an X instead of an exclamation mark there beside number one license information and so we're done with this so we can hit C to continue and complete our first boot into cintos now that the system is booted up I'm going to go ahead and log in as
myself here when you first log in It'll ask you to confirm your language I'm English so that's already selected and I'll click Next here it'll also ask you about your keyboard layout and English us is checked and that's what I'm using so I'm going to click next and now we're all set the installation is complete so I'll just click start using cintos now now this getting started screen is displayed and so you can take some time and read through some of the documentation and watch some of the videos for example and so at this point
the installation is really complete so our job would be done Right here if we're running on physical Hardware such as a desktop a laptop or a server however since we're using a virtual machine we need to perform one additional step that additional step is to install some software that helps Linux understand the virtual Hardware that it's working with and that piece of software is called virtual box guest editions now what we need to do is insert the guest Edition CD image and install those guest editions so I'm Going to press the host key to get
control of the keyboard and mouse and now I'm going to go to the devices menu and click insert guest editions CD image you'll see a popup that asks you if you'd like to run the software that's on this image and we do so I'm going to click inside the virtual machine here to get the the mouse control back to the virtual machine I'm going to hover over run and click it now we need to enter our password for The account since we have administrative privileges that we specified during the installation we can do things such
as install software which is what we're doing now so I'll just go ahead and enter in my password click on authenticate and now the guest editions will be installed guest editions requires that the developer tools were installed and if you remember when we selected the software for the Installation we checked the check boox beside development tools so if you have problem installing the guest editions you need to make sure that that was checked during your installation so now that the installation is done we can press return to close the window so I'm going to go
ahead and X Out of the getting started and I'm actually going to reboot the virtual machine to show you what happens when you have guest editions installed so I'm going to click In the right part of the screen hit the power button here and I'll just do a restart go ahead and log in again so I'm going to press the host key again to get control of the mouse and I'm going to go to the menu here and then I'm going to click View and take us out of scaled mode so I'm just going to
hit scaled mode there and then the screen will snap to a smaller size and so what's interesting now is the resolution is better so now I can take The screen and drag it to uh how whatever size I want and now the graphics in the desktop look a lot better than they did on first installation and in that scaled mode so one of the things that the virtual box guest editions does is provide a better display experience for you okay that wraps up the manual installation of Centos in this lesson you're going to learn how
to log into a Linux system and we'll Talk a little bit about ssh what that is and what as the clients you need to use if you have Linux installed on Hardware that you have physical access to or you have Linux installed in Virtual Hardware like a virtual machine running in Virtual box then you can connect directly to the Linux server in this example we'll be looking at Linux running in a virtual machine and vir box you can highlight your Linux virtual machine and click the green Button to start it up we'll give it a
few seconds here to boot each Linux login screen will be a little different in this case you're given a list of users to choose from and when you click on that user you can enter in the password for that user and click the login button um I'm going to select Json type my password I could either hit enter here or click on the login button that's all there is to it just Enter your username and password in this example you're given a graphical user interface the Linux desktop in order to interact with the command line
you need to start the terminal emulator application in Centos this is located in the applications and then systems tools menu there you see terminal just click on it and the next lesson will start interacting with the command line for now you just need to know where the Terminal application is so you can start it and to exit it you simply type exit to log out of cintos go to the system menu and log out on some Linux systems you'll be prompted for a username in this case you have to type in your username I'm going
to log in as Jason so I'll type Jason and I can either hit log in or hit the enter button then I'll type in my password let's see what it's like to log Into an auntu Linux system we'll highlight the virtual machine and instead of clicking the Green Arrow this time we can rightclick and click Start sometimes these are configured to Auto log in so you may not even have to enter a username and password in you'll just be given the desktop in this case you see a menu again with a list of users that
you can select and then enter the password for that user hit enter to log In I'm going to select the virtualbox images.com user and and that username is actually admin user and the password is admin user what is displayed in the menu is the description of the account you can see that the auntu desktop is different than cintos again each Linux distribution is going to look slightly different and function slightly differently going to exit out of the web browser Here you see a list of applications on the left hand side of your screen you can
click on one of those to start it if you don't find what you're looking for you can click on the button in the top left and type in a search term this case we're looking for the terminal application so type in terminal and click on the terminal and there we are at the command line and again to exit the terminal application just type in the word Exit in this desktop environment M to log out or shut down go to the top right hand corner and click the gear icon I'm going to choose shut down and
when prompted I'll click on shutdown again sometimes you'll be presented with a text prompt to log in instead of a graphical user interface again just type in your username and password if you installed a server distribution instead of a desktop distribution this is the type of login prompt that you would Expect to see again to exit just type the word exit I'll log in as the admin user with the password of admin user if you're going to connect to a Linux system over the network more than likely you're going to use SSH ssh stands for
secure shell SSH is a network protocol its primary purpose is to allow you to connect from one system to another system securely over a network in the past you would use telnet SSH has replaced telnet as its more Secure counterpart telnet is practically obsolete today but you may encounter it if you have to connect to a legacy system we've already touched on Terminal emulators a couple of times in this course already in order to connect to Linux over the network we're going to need a terminal emulator that also actess an SSH client for Windows the
most popular SSH client and terminal emulator is a program called putty to get putty you can open up a web browser And type in [Music] PTY the first result in Google is the download page and you only need PTY y.exe at this point going to save the file now I'm going to open the file and run the program in the host name or IP address box I'm going to type in the network name of my Linux server in this example I'm using l n Svr whoever created your account on the Linux server will be able
to give you the details of either the host name or the IP address to use this could be a server at work it could be a shared host account so maybe you're sshing into your bluehost.com or hostgator.com SSH account leave the default port at 22 unless you were specifically given another port to use click open to start the connection the first time you connect to A server you'll get a security alert and you can simply just click yes on this this will only happen the first time you log into into a server now you can
enter your username and password to login type exit when you're done putty has many features and options one of the things you can do is specify your username in putty before you try to connect on the right hand side click on data and then fill in the Auto login field I'm going to save this as a session so that I can quickly log into the server again in the future I'll give it a name and click the save button and then when I double click it it will start a connection to that server you'll see
that putty has already provided the Linux server our username and now alls we have to do is enter in our password I'm going to highlight my saved session Click load and change the font go to the left hand side click on appearance under window and then I'll change the font make it nice and large so we can see you may have been given a IP address for your server so if you don't have a name but an IP you can use that as well again the first time you log into a server or a particular
IP address it will ask you to confirm the post key just click Yes again putty knows our username because we've specified it and now we simply enter in our password in order to connect to a Linux system from Mac you need to start the terminal application this is located in the applications folder and there's a subfolder in there called utilities you'll find terminal.app and that directory once the terminal application has started you can use the SSH command To initiate a connection commands are case sensitive so be sure to use lowercase ssh in this example my
username on my Mac desktop is Jason and on the Linux server it is also Json so I'm just going to type SSH Linux server again just like in Windows you'll be prompted about the host key and you only have to accept this the first time you connect so I'll type in yes and then I'll be connected to the Linux host to exit type exit if you want to or need to connect to the remote system using a different username you you type in SSH space that username the at symbol which is shift 2 and the
name of the Linux server in this case I'm going to use admin user and admin user is the password now we are logged into the Linux system and I'll type exit to get back if you are using Linux at work you might connect to a server that ends In.you compan name.com again just use the host name or IP address that you were given to use you'll see that connecting to an IP address works as well to recap if you have physical access to a Linux system or if that Linux system is running in a virtual
machine as in Virtual box then you can log into it directly sometimes you'll be presented with a graphical interface to log into sometimes it'll be just a Textual prompt if you're going to log into a Linux system over the network you are going to use SSH for Windows users I recommend using putty as your SSH client for Mac users use the built-in terminal application and the command line SSH client if you're trying to access a virtual machine that is running on your system the easiest way is to Simply start up The virtual machine and interact
with it through virtual box for this course there really is no need to connect to the virtual machine over the network I really recommend just typing into the virtual machine directly for this course here's an example I've went ahead and started virtual box on my local machine or my host system and I have a virtual box that is running I'm simply going to open this virtual box and you can see that it's in a window in a Virtual box window you can see the the uh menu options from virtual box itself so what I'm going
to do is simply click into this virtual machine and then interact with it as if it were a real physical Linux machine that I'm sitting in front of you know I can do things like start a terminal or start a web browser and I can you know just type right into to this system and that's really how I recommend you go through this course however if you want to Connect to the virtual machine that is running on your computer over the network see the lesson on this topic toward the end of the course I created
that lesson specifically for the few students who asked to learn more about that topic I placed it at the end of the course because it requires the use of some techniques that are not covered until later again that lesson is totally optional and I recommend that you proceed with this course and only watch That lesson if you're specifically interested in that topic and that you watch that lesson only after you've seen all the other lessons in this course if you are finding value in this course I want to invite you to leave a five-star review
in the top right hand corner of your screen click on write a review click the star on the right if you want to you can leave some comments but it's totally optional thanks for your review not only does it encourage Me to keep the content of this course up to date and even create more resources for this course but it also helps others like you find this content thank you so much in this lesson we're going to talk about the Linux directory structure where you can find different components of the Linux operating system and we'll
see how applications can use the same conventions as the Linux operating system for their directory structure as well first I'd like to share with you Some of the most common top level directories that you'll see when using the Linux operating system there might be several top level directories to be aware of but these first few are the most important and they're the ones that you'll interact with the most often the Linux directory structure is like a tree the base of the Linux file system hierarchy begins at the root directories will start to Branch off the
root but Everything starts at root the directory separator in Linux is symbolized by a forward slash most of the time we just abbreviate this to slash often root is referred to as slash since there are no other directories if you hear someone say look in slash or that file is in slash they are referring to the root directory bin or /bin is where you will find binary files or executable files programs are written in source code and This is human readable text these text files are then compiled into machine readable binaries they are called binaries
because machine code is a string of zeros and ones just know that applications that you can run are sometimes located in/ bin SLC or Etsy is where you'll find configuration files configuration files control how the operating system or applications Behave for example there's a configuration file in /c that tells the operating system whether to boot into a text mode or into a graphical mode slome is where user home directories live so for example my home directory would be slome sjon Linux systems can and often do have multiple users or multiple user accounts and the home
directory is where you can separate your data from another accounts data you can store anything you want to In your home directory you could store documents or music files or your vacation pictures opt is where optional or third-party software lives opt is for software that is not bundled with the operating system for example Google Earth is not part of the standard Linux operating system so Google Earth gets installed in opt SL TMP is called temp and it's for temporary space and most Linux Distributions clear sltm at boot time so if you put some files in
temp and the Linux server gets rebooted or your Linux desktop gets rebooted your files will be gone now temp is a great place to store temporary files but do not put anything in temp that you want to keep longterm /usr is called user and this is where user related programs live each one of these directories can have subdirectories for example we already Talked about home slome username user is no different there will be a a subdirectory structure within user and you'll find binary programs and executables located in/ USR SLB user bin SLV also called VAR
is for variable data than of things that change often things that change often on a Linux system are typically log files that are generated either by the operating system itself or applications in Linux we typically talk about directories in other operating Systems they may call the similar concept folders if you think about it in terms of folders then slash or root is the main folder and each one of these are subfolders again folder and directory is often used interchangeably in Linux again we're going to use the the term directory here's a graphic that illustrates that
each one of the directories hang off of Slash or start at the Root this graphic just illustrates that each directory can have many subdirectories here's yet another way to visualize this and this example we can see slome sljs has three directories documents downloads and music up until this point we've only talked about a few top level directories however when you actually get on a live Linux system you're going to see that there are several other top level directories I want to expose you to These other top level directories so that you're slightly familiar with them
when you see them on this screen maybe the most interesting one we see there that we haven't covered yet is/ cdrom and oftentimes Linux distributions will use that directory as what's called a mount point and when you insert your CD ROM it will get mounted on/ cdrom so that is where you can access the files that are located on the cdrom other Linux distributions use SL Media again this is where you could find files that are located on CD ROMs or DVDs that you place inside your computer already talked about opt some Linux operating systems
use SL SRV as a location to place data that is served by the Linux server for example web files would be an SRV www or if it's an FTP server maybe the files would be located in/ SRV SFTP we mentioned earlier about user having subdirectories user bin user Library Etc let's switch gears and start talking about application directory structures you'll find that some applications that are not bundled with a Linux operating system are installed in user local and often they're installed in user local program name and from there they'll have their own subdirectory structure in
this example crash plan is backup software that's not bundled with A Linux operating system if you were to install from their website it would install into user local crash plan and if you wanted to find the binary for this program you would look in user local crash planed bin if you wanted to configure how the program behaves at runtime you would modify configuration files that are located in user local crash plan Etsy if you wanted to see the log files that the program is generating again look in log user local Crash plan log we've already
talked about how applications can be installed in opt AVG is antivirus software it's not bundled with a Linux operating system and this particular application installs an opt opt AVG again this is a common pattern opt program name B here is a slight variation that you'll sometimes see applications swall let's take this fictitious application called my app for example Even though the main Mya program gets installed in opt my app where maybe the binaries live and the libraries live you'll also see that it can install files in Etsy opt my app and that's where you would
find the configuration files the log files would be in /var slopy apppp sometimes when applications get installed they're not given their own directory structure they're installed in a shared manner so maybe my app gets Installed in user local and this case it would be user local bin my app and the configuration file could be user local at ca.com user local bin would not only contain my app but other applications that were installed in this shared manner another common practice is to use opt company name or opt organization name for example if you work for the
Acme Corporation and you logged on to one of their Linux servers you may see Something like opt Acme bin where the software that was written for that company or by that company is installed another slight variation on this theme is opt company name product name a real life example is Google when you install Google Chrome on Linux it installs into opt Google Chrome Earth installs to opt Google Earth here's yet another slight variation opt organization name or opt company organization name or even user local company name organization name The most important thing to know about
applications that are not shipped with the Linux operating system is that they're typically found in SLT called opt or n/ USR called user and when these applications are installed they're typically installed in user local usrl the most common top level directories that you'll interact with on a Linux system are slash also called root then B Etsy home opt temp user and VAR and applications that are not shipped with the operating system are typically installed in user local and opt in today's lesson you will learn what the shell is how to access it and we'll talk
a little bit about the super user account the shell is the default user interface to Linux system when you log into a Linux server over the network the shell is the program that has started and it accs as your default interface to The system also if you're presented with a text based login prompt you'll also be interacting with the Shell by default if you log into a graphical user interface then you'll need to start a terminal emulator application to gain access to the shell and cintos for example you can go to the applications menu then
system tools and click on Terminal in auntu you need to start a program called the dash to do that you Click on the top icon in the launcher which is on the left hand side of your screen it's the icon with your BTU logo on it start typing the word terminal and you should see the terminal application pop up and you can click on it to start it the graphical user interface on a Linux system is also called a shell it's a graphical shell however if someone isn't specific and they say shell sh they're typically
talking about the Command line interface the shell is really nothing more than an application or a program that takes the commands you feed it and it executes those commands for you sometimes you'll hear the shell referred to as a command line interpreter the command line interface can be more powerful than the graphical interface for example if you have several files and you need to perform the same operation on those files you Can often do this easily at the Shell for example if you had 100 documents that you needed to rename you could run a command
at the Shell to do all 100 at once if you were using the graphical user interface you would have to click on the first file rename it go to the next file and do that 100 times in this instance the command line is a much better solution another reason you want to be familiar with the command line and be Able to use it effectively is that it's always going to be there most server editions of Linux distributions do not include a graphical interface also when you're connecting to a Linux system over the network you're typically
going to be connecting via SSH or secure shell this will give you access to the command line interface as well desktop Linux distributions have both graphical user interfaces as well as command line Interfaces this allows you to have the best of both worlds when it makes sense to use the command line you use the command line when it makes sense to use a graphical program use that program for example if I'm working on a Linux desktop and I want to visit Wikipedia on the web I would start a graphical web browser like Firefox for instance
there are commandline web browsers that come with Linux so you can surf the web from the command line given The choice of using the command line for web browsing or a graphical web browser such as Firefox I would choose Firefox any day when the shell is started it displays a prompt or a shell prompt The Prompt simply just sits there and stares at you waiting for you to do something interesting like give it a command to execute a shell prompt typically gives you some sort of useful information in this example prompt you will see a
Username Json at and the name of the Linux system that you're connected to in this case Linux svr or Linux server at the end of The Prompt you'll see a dollar sign this is an indication that you're using the system as a normal user as opposed to a super user the super user shell prompt ends typically with a pound sign the super user on a Linux system is also called root it's the root account we've previously talked about The root of the file system or slash being root this is a different rout this is an
account called root so when someone talks about root they're either talking about Slash the beginning of the file system or the super user account named root the root account on a Linux system is similar to an administrator account on a Windows system anything that can be done on a Linux system can be done by the root User normal user accounts can only do a subset of the things that the root account can do most of your day-to-day activities will be performed with a normal user account rout access is typically restricted to system administrators for example
if you're working in a company and you have access to Linux servers there will be a team of people that are responsible for the upkeep maintenance and configuration of Those servers and those people are system administrators sometime there are not dedicated people that are system administrators for example if you're running Linux on your desktop you'll have access to a normal user account and the root account you may need root access if you're going to install an app application that resides outside of your home directory you also may need root Access in order to start or
stop that application applications that run as services or servers typically need root access to start for example you need root access in order to start a web server however you don't need special privileges to start normal applications like a web browser for instance prompts can vary greatly in appearance sometimes they're very simple they're only one character in length like a dollar sign sometimes they Contain more useful information such as the account you're using the name of the server that you're connected to and the directory that you're currently in in a couple of these prompts you'll
notice a Tilda the Tilda is a shorthand way of representing a home directory the Tilda use by itself represents your home directory or the current accounts home directory that you're using for example if I'm logged into a Linux system with adjacent account Tilda represents /home Sjon you can also append a username to the Tilda and that will expand to that account's home directory for example Tilda Pat could expand to slome Pat Roots home directory is typically in/ rot so till the root equals SL root not all accounts on a Linux system are associated with an
individual user for example Services often have their own accounts in this case till the FTP expands to the home directory of the FTP Service account which lives in/ SRV SFTP so far we've looked at prompts that are contained within a single line just know that they can span multiple lines as well later in this course you'll learn how to customize the shell prompt to your liking in summary the shell is a default user interface for the Linux system you're automatically presented with a shell prompt if you connect to Linux over the network using SSH if
you log into the graphical user Environment you can start the terminal application to gain access to the command line root is a special user on a Linux system it's the all powerful super user your DayDay activities will be performed using your regular user account in today's lesson we're going to cover some basic yet essential Linux commands commands in Linux are case sensitive so lowercase LS is not the same as capital L capital S this really isn't much of an issue because most Commands in Linux are all lowercase here are the commands we're going to cover
today LS lists directory contents it can also display detailed information about files and directories CD is the change directory command it does what it says it changes the current working directory when you log into a Linux system syst you're automatically placed into your home directory you can use the CD command to navigate around the file System the PWD command displays the present working directory or your current directory cat concatenates files really what cat does is it displays the contents of files Echo displays arguments to the screen it may not be immediately obvious how this is
helpful but in a minute when I show you some examples it will become clear Linux systems come with built-in documentation you can use man to display The documentation for a given command on the Linux system you may hear people refer to Man pages this is the documentation that you can view with a man command to exit or log out of your shell use the exit command finally clear clears the screen let's see some of these commands in action first let's look at LS if you run LS without any argument it Lists the files in the
present working directory in this example we see several items in this directory desktop downloads notes Etc and this example LS output is colorcoded this may not always be the case but it is a common thing to see on Linux distributions we can run LS with A-L option which displays a long listing format here we get more information about the files and directories that are Displayed in a later lesson we'll cover what all this information means as you recall earlier I said Linux commands are case sensitive so let's see what happens if we type in capital
LS we get an error saying that the command is not found let's try capital L lowercase s lowercase L capital S same thing so LS Works lowercase Capital does not let's use the CD command to change the directory Directories and files are also case sensitive so Capital TPS lowercase reports is not the same as all lowercase TPS reports can use LS to see what's in this directory and we can use ls- l to display a long listing more detailed information about these files cat will display the contents of a file this file only has one
line in it Echo is used to display the contents of variables and we'll be talking about Environmental variables later on use the man command to learn more information about how to use a particular command type the word man space and the command you want to know more about in order to display the next page of information simply hit the space bar when you're done looking at the man page type Q to quit man here's the man page for LS you'll see how LS has a lot of options here's one that we've been using in this
lesson DL use a long Listing format so as you can see there's a lot of information in the Man pages we'll talk more about the man command in the next lesson the clear command clears the screen if you execute CD without any arguments it takes you back to your home directory PWD will display your current or present working directory in order to exit your session type the word Exit today the commands we've talked about are LS which displays the contents of a directory CD which changes the current directory PWD which displays what directory you're currently
in cat that displays the contents of files Echo displays arguments man displays documentation about commands exit exits your shell and clear clears your screen start becoming familiar with these commands these are simple and Basic but yet you'll use these often if you'd like you can look at the man page for LS and start exploring some of the options that it has to offer we'll be covering some of the more important options to LS in a later lesson however this will just give you some practice at using the man command and navigating within man in today's
lesson we're going to talk about how to navigate Man pages what the path environment variable is Used for what the witch command does how to ask commands for help and how to search for Man pages when using the man command there are a few key combinations that you should be aware of enter moves down one line so every time I hit enter you see the page just moving down by one line if you want to move down and then entire screen or Page worth at a time hit the space bar if you want to go
to the top of the page type lowercase [Music] G and to move to the very bottom capital G shift G and to quit you simply type Q enironment variables store information they storage locations that are a name value pair and they're typically uppercase all the letters in the variable are uppercase and you can see the contents of the variable by using the echo dollar variable name Command we'll go into greater detail about environment variables in a later lesson however the environment variable that we're most interested in today is path path is an environment variable it
controls the command search path it contains a list of directories that are separated by a colon what I mean by that it controls the command search path is that when you type in a command at the prompt and press enter that command will be searched for in the Directories that are listed in your path environment variable in this example user local bin will be searched first if the command is found there it will be executed if it's not found then slash bin will be searched and this process goes on and on until either the command
is found in your path or if it doesn't match your request then you'll be politely told that it can't be found if you want to know the location or the full path to the command that You're executing use the which command for instance you could type which cat now if there were multiple programs named cat then the one that gets executed depends on your search path if cat is in/ bin and also in / user local bin whichever directory occurs first in your path will be the cat command that gets executed here's an example of
using which with the TAC command Tac is cat spelled backwards so can you guess what Tac does that's right it displays a file's contents in reverse order putting this all together you can start looking at what is in each directory in your path and use the man command to discover what each and every one of those programs does in theory you could teach yourself how to use Linux this way however it would be a long tedious process and not very efficient knowing about the path environment variable gives you an idea of where commands are Located
on the Linux system if you have an idea of something that you want to do but you're not exactly sure how to go about it or which commands to use you could start by looking in your path looking in those directories and see if any one of those commands may help you out and then you can get more details on exactly how to use that command with the man command many commands will provide hints for how to use them at the command line some commands will accept the d-h Flag and others will accept DH and
some will refuse to give you any help at all in that case you would use the man command aless will provide some information at the command line when you specify D- help you can get help from gzip by using Dash or --el if you're not sure which command to use you can search through the Man pages with man space- k space your search term from there you can read the man page for the command or ask for help with DH or D-el in this example if we search for calendar we see a couple of programs
and we can just type man and those program names to determine which one does what we want to do in summary man is the command you can use to display the documentation that is built into the Linux system the path environment variable controls your search path it can determine which command gets executed you can learn the full path to A command with the which command by typing which and the command you're interested in for example which LS you can ask commands for Help by using --el or- and if you want to search Man pages use
man - K here are some suggested next steps log on to your Linux system take a look at your path environment variable go through each one of those directories and perform an LS on it for example your path may contain SL bin colon sluser Sbin so you could type LS space SLB or LS space usrp You could also change directory to those directories and then perform an LS there for example you could type cd/ bin and hit enter and then you're in the bin directory and you can simply type LS from there pick some commands
that look interesting to you and run man against them additionally pick a few commands and try using d-el and DH on them in today's lesson we're going to Talk about some shorthand ways to access directories how to execute commands that may live outside of your path environment variable and how to create and remove directories directories are just containers for other files and directories in a previous lesson we've already covered how directories provide a tree likee structure for the file system directories can be accessed by their name a full path or a couple of Shortcuts that
we're going to go over next when working on Linux systems a period is often referred to as dot this is no different than google.com instead of Google period so in Linux a single dot represents this directory the current directory two dots represent the Parent Directory you can think of the Parent Directory as being the directory above your current directory the CD command provides a shortcut as well if you type In CD space- enter then you'll be placed into your previous directory the directory separator in Linux is the forward slash so you can think of directories
as ending in slash and often this is understood for example if you CD into slome SL Json that's the same thing as running CD slome Json SL using directory shortcuts can make navigation easier so let's look at a couple examples PWD shows our present working Directory you can type in the name of a directory to change to it it shows that we are in that directory CD do dot is go to The Parent Directory let's run that again cd. dot that takes us to [Music] /home and then you can end directories with a slash so
CD Json is the same as CD Json slash see what happens when we type CD space Dot so the dot didn't take a anywhere because dot represents this directory let's do this one more time CD do dot takes us to the direct above and we can also specify a full path for instance CD slome sljs or CD /home Jason SL let's change to another directory CDV VAR temp old PW D this environment variable holds the directory that you were previously in so if we look at that it Shows us that we were previously in home
Json so if we use CD space Dash that takes us back to home Json we've previously talked about how the environment variable of path determines your command search path you can specify a command with a full path you can execute command commands that are not in your path and if you want to execute a command in the current directory you're in you type dot SL and The command so our path environment variable determines where your shell will look for commands so which tells us that if we just ran Cat that it would run Ben cat
and we can also specify the full path to that /b/ C A and we get the same result however if we want to run a different cat then we could do something Like this again that cat will not be executed because home Jason my- cat is not in the path environment it's not in my command search path let me change directory into my cat so we can remember that dot is this directory slash is a directory separator and this is the name of the program and it executes so if you want to execute something in
your current directory just remember dot slash and The name if you want to create a directory you can use the mkd command now that d p is in Brackets and when I place something in Brackets that means that it's optional so make directory requires that you give it a directory name to create however DP is optional so mkdir space new dir will create a new directory uh named new nwd - P stands for parents so if we want To create a directory structure that is more than just one directory deep we need to specify Dash
P so that it will create the parent directories for example we could use make dur space- P Space 1 SL2 sl3 that would create three directories with one command one that's one directory 1/2 that is your second depth your second directory 1 SL2 sl3 your third directory when you want to remove a Directory use the rmd command the rmd command only removes directories that are empty they have no file contents so if you have a directory that you want to remove it and all the files you need to use rm-rf that directory name and that
recursively deletes everything in that directory and below that directory one important thing to note when you're working at the command line in Linux There Is No undo there is no Trash can that you can go and retrieve a file that you've deleted when you delete something it's gone when you recursively delete something all of those files and directories that you recursively deleted are gone you can't get them back so just be careful when you're using rm-rf let's create a directory let's try this again we can see that makeer command will not create the third directory
Because its parent D2 does not yet exist so if we want mkdr to do this we'll need to specify - P for parents so that it will create the di2 directory and that worked again the rmd command only removes empty directories so dir1 contains dir2 and 3 if we want to recursively remove them we can use rm-rf di1 and now that will delete Di r 1 and if there were any files in that Directory they they would be gone in this case there's only one directory there so dr2 will be gone and then all the
files and directories that are that are in there again this deletes everything recursively so anything at di1 and below will be gone and you can't get it back today we've talked about some directory shortcuts how dot represents this directory and dot dot represents presents a Parent Directory how CD space Dash will take you to the previous directory that you were in we talked about how to execute commands that may not live in your search path you can use a full path or you can use dot slash and the name of the command to run a
command that is in the current directory that you're in we also talked about how to create and remove directories practice navigating with directory shortcuts like CDs space. dot to take you to the Parent Directory and CD space Dash to take you back to the directory that you were previously in also execute some commands with full paths like SLB cat to execute cat also work on creating and removing directories and using rm-rf to recursively remove directories in today's lesson we'll be talking about the components of the long listing format of LS we'll talk about hidden files
and directories we're going to list files by Type and sort them by time and we're going to talk about handling spaces and file names and directory names and also we're going to talk about what symbolic links are here is some sample output from LS used with A-L option if you just want to see what files or directories exist you can run LS without any options but if you want to see detailed information use LS based - L the first bit of information that is Displayed is a series of characters which represent the file's permissions we
won't go into detail what every character in that string means but we'll be covering that in a later lesson so the first group of characters is the permissions the second bit of information is the number of links to that file or directory next we see who the owner of that file is and what group that file belongs To the size of that file and the last time that file directory was modified and of course at the very end is the name of the file or directory itself files or directories that begin with a period or
a DOT are considered hidden files so if you run LS it will not display hidden files by default in order to see hidden files you need to use the- a option to LS if we want to see a long listing output that includes hidden files we could run LS space- L space- A there's also kind of a shortcut for this you can just include one hyphen and then follow it by all the options that you need for instance LS space- La is the same as LS space- L space- A let's run LS in this directory
you notice that there are no files that begin with DOT so if we want to see if there are any hidden files we can run LS with A- a option and now we see a few more files that show up bash history. bashrc we've Already talked about dot which means this directory and dot dot which is the Parent Directory if we run an ls- L Again by Default hidden files are not displayed you can run Das shell for a long listing and- a for all files and now we see the dot files or the hidden
files doesn't matter which order that we specify these command line arguments as I mean- A-L does the same thing as- l- A and then also know that you can combine the arguments with ls space- L for long listing and a for all files and again the order doesn't matter so we can do LS space- and we get the same output when you perform an LS by itself you may or may not know what is a file and what is a directory you can use LS space- capital F to reveal file types LS space- capital f
appends a character to a file or directory name That tells you what it is so if it ends in slash or forward slash then it's a directory if it ends in an ampersand that's a link a star or an aster means that it's executable you can think of a symbolic link as a pointer it it looks like a file or a directory but it just points to where the actual file or directory is and you would operate on the symbolic link or Sim link for short the same as if it were the file that it's
pointing To sim links are often used used to create shortcuts to Long file names or long directory paths another common use of sim links is to indicate the current version of an application let's change into this directory when we perform in LS we don't know if current is a blink if it's a directory if it's a regular file or an executable file we can get this information by running ls- capital f And we see that current is a link the two my apps are directories and readme is a regular file and we can confirm by
running ls- L capital F for a long listing format and we see current points to my-- 2.4.7 here we see a program it's an executable because it ends in an asteris or a star and we can execute this by doing slm A if you want to list files sorted by time use LS space- T use the dasr option to reverse the order and a common command that I like to use is LS space- L A this provides a long listing that includes all files sorted by time in Reverse let's look at this directory with an
ls- L it sorts the files and directories by name if we want to reverse this we can use long listing and R for Reverse now we'll see it's sorted in Reverse videos comes first as where with LSL videos was last let's do a long listing in cluding all files sorted by time and we see bash history is at the top it's the most recently modified file if we do ls- L A TR that will reverse this output and we'll see the most recently modified files at the bottom and this can help if you have a
long list of files and they Can scroll off the screen so you'll get the most recent files displaying on your screen to list directory contents recursively use LS space- capital r this will display all the contents of the current directory and any subdirectories below that the tree command does a similar thing to LS space- capital r but it's more of a visual output you can give tree A-D option and that will only list directories and if you use a-h capital c That will colorize the output tree is on a lot of Linux distributions it may
not be installed by default so you may or may not have access to this command like the tree command LS has A-D option that only lists directory names and not their contents by default when you run LS space directory name LS will provide the contents of that directory you can also tell LS to colorize output by using LS space-- color this is just another option to Distinguish file types you can do LS space- capital F or LS space-- color or even combine the two if we want to display recursive output we can use LS space-
capital r and a lot of the information has scrolled past the screen but that's okay the tree command is something similar it displays things in a visual output and you see files and directories in this example if you only want to look at the directory structure you can use Tree with the- d option and if you want to colorize the output you can use tree- C or Capital C and then you could even combine the two if we run LS against a directory such as music you can see that it displays the contents of Music
which in this case is jazz if we only want to look at the directory itself we can use ls- D that may not make much sense in this case so maybe let's use ls- l Music and you see long listing inside of Music which is jazz ls- L long listing only show the directory of music and so now we can see for instance the last modification time of the music directory can use-- color for LS to get color output and sometimes this is done by default on some Linux distributions and the color coding here like
in this configuration blue are directories and we can confirm this by using Dasf if you want to make your life a little bit easier when working at the command line do not use spaces in file and directory names instead getting the habit of using maybe a hyphen or Dash where you would use a space or maybe an underscore or even something called camel case where you can capitalize the first letter of each word sooner or later you're going to encounter a file name that has a space In it it maybe a file that you didn't
create and someone else did you have no control over that how you can deal with this is wrapping the file name in quotes be it single quotes or double quotes another thing you can do is escape the space character to escape something you preceed it with a backslash in this output you can see a file named my space notes. text if we were to try to run an LS against that you'll see that LS treats it as two Different files not one file name with a space so to get around this we can use quotes
that works using double quotes also single quotes will work what we could have done instead was maybe nameing the file my- notes. text or maybe mycore notes. text or even my notes like this or even my notes. text in today's lesson we've talked about some of the more common and useful LS options we learned about Sim links Talked about hidden files and directories and how they start with a DOT and we talked about a couple of strategies for dealing with spaces and file names here are the ls options we covered today- a to list all
files-- color to list files with colorized output - D to show directory names and not directory contents dasl for the long listing format dasr for reverse order - capital r to list files Recursively and- T to sort files by time and today's lesson we'll be talking about symbolic permissions numeric permissions File versus directory permissions how to change permissions how to work with groups and the file creation mask here is some output from an ls- L command and if you look at the permission string the first character will indicate whether it's a regular file by beginning
With a dash or it will begin with a d if it's a directory or an L if it's a symbolic link other characters that you'll encounter in the permission string include r w and x r w and X represent the three main types of permissions they are read which is R write which is w and and execute which is X if you have read permission to a file that means you can see its contents for example you could run cat against the File and you would see the file's contents if you have right permissions to
a file you can modify it you can change its contents if you have execute permissions you can run that file as a program read write and execute are fairly self-explanatory when they're applied to files however they have a slightly different meaning when they're applied to directories for example when read Permissions are applied to a directory that means you can see the file names in the directory if you don't have read permissions to a directory you will not be able to see the directory's contents the right permission when applied to directories allows entries to be modified
within the directory so you can edit files that are in the directory the execute permission gives you the ability to see metadata about the files that are in the directory read Permissions give you the ability to see file names whereas the execute permissions give you the ability to see modification dates and owner and group information just like you would see NN ls- L long listing output there are categories of users that these read write and execute permissions can be applied to these categories are User Group other and all and un likee the permission types each
one is represented by a single letter For example you represents the user that owns the file the users that are in the files group are represented by G users that are not the owner or are not in the files group are considered other represented by o a is used to represent all or everybody every user on a Linux system belongs to at least one group called their primary group however users can belong Bel on to many groups for example if members of the sales team need access To some of the same files and directories they
can be placed into the sales group run the groups command to see what groups you are a member of if you supply another user's ID as an argument to the groups command you'll see a list of groups to which that user belongs you can also use ID space- capital G lowercase n as a synonym for groups it will give you the same output in this example running the groups command shows that I'm in the Json group And the sales group you can also see that ID space- capital G lowercase n Returns the same value as
the groups command does if you're in the groups command followed by another username you'll see the groups that they are in for instance Pat is in the finance and New York groups the admin user is only in the admin User Group at this point you finally have enough background information to start decoding The permission string we covered that the first character is the type be it a directory a file or a link the next three characters represent the permissions available to the user also known as the owner of the file the next three characters represent
the permissions available to the members of the files group the final three characters represent the permissions available to all users with permissions order has meaning So permissions will always be displayed in this order user followed by group and finally others also the permission types of read write and execute are always displayed in that order too so if a particular permission is not granted a hyphen will take its place permissions are also known as modes that's why the command you use to change permissions is called chamod which is short for change mode the form format of
the chamod command is chamod mode File and there are a couple of different ways to specify the mode one is symbolic notation and the other is numeric notation to specify modes or permissions with symbolic notation run the chamod command followed by user group other or all and an operator to add subtract or set permissions followed by the permissions themselves read write or execute you can add subtract or set permissions using user category and permission Pairs so pick a category User Group other or all let's pick group what we want to do add subtract or set
the permission let's add can add read write or execute so let's just add the right permission you can see that an extra W shows up in the permission string and the appropriate place for group you can undo this by removing or subtracting that [Music] permission you can also change more than Just one permission at a time so we can specify the group have right and execute permissions if you want to set different permissions for different user categories you can separate the specifications with a comma so for instance we can specify something for the user let's
add readr execute and for group let's take away execute and you can see that that change has taken effect when you specify an equal sign that sets The permission to exactly what you specify so let's say all is set to read and we can see now that the owner or the user the group and other are all set to just read permission also if you don't specify permissions after the the equal sign all the permissions are removed so let's set the user read WR execute group two read execute and we'll give no permissions to others
in addition to symbolic mode Octal mode or numeric mode can be used with chamad to set file and directory permissions in octal mode permissions are based in binary each permission type is treated as a bit that is either set to off zero or on one again in permissions order has meaning so permissions are always in read write and Execute order so if r w and X are all set to off the binary representation is 0 0 0 if they're all set to on the binary representation is 1 1 one if you want to emit the
right per permission the binary representation would be 1 0 1 to get a number that you can use with chamod convert the binary representation into base 10 or decimal so really the shortcut here is to remember that read equals 4 write equals 2 and execute equals 1 the permissions number is determined by adding up all the values for each permission type there are eight possible values from 0 to 7even hence the name Octal mode this graphic lists all eight possible options the user categories are always in user group and other order so once you determine
the octal value for each category you specify them in that order so for example to get read write execute for user read and execute for group and just read for other you would specify chamod space 754 space the file name here are the most commonly used Permissions so 700 ensures that a file can be read edited and executed by the owner and no one else on the system will have access to that file the 755 permission allows everyone on the system to execute the file but only the user or the owner of the file can
edit that file file 664 allows a group of people to modify the file and let others read it and 660 allows a group of people to modify the file and not let others read It mode 644 allows everyone on the system to read the file but only the user or the owner of that file can edit that file if you're ever tempted to use 777 or 666 for permissions ask yourself if there's a better way to do that because giving 777 permissions gives everyone on the system full access to that file directory for example if
a program or a script is set to 777 permission then anyone on the system can make changes to That script or program since the execute bid is set for everyone that program can be executed by anyone on the system so if malicious code was either inserted on purpose or by accident it could cause unnecessary trouble if multiple people need right access to a file consider using groups and limiting that access to the members of that group in general it's good to avoid 777 and 666 permission modes when you create a file its group Is set
to your primary group so if you're a member of multiple groups for example sales and training group if sales is your primary or first group then when you create a new file it will be in the sales group if you want to change the group of a file use the chgrp command you can see that when I created the sales. DAT file that it was put in my primary group which is Json I'm also a member of the Sales Group so let's change the group to sales for this File now we can see that the
group is sales and let's give permissions so that other people in the sales group can edit the file there we go so instead of keeping files in different people's home directories maybe you could have a common place to store these so on this system there's a user local sales directory and you can see that the sales group has read write and execute permissions for that so I'm Going to put the shared file and that shared location now anyone that is a member of the sales group can and edit that file let's look at directory permissions
again permissions on a directory can affect the files in that directory a common problem is having proper permissions set on a file with in a directory only to have the incorrect permissions set on the directory itself not having the correct permissions on a Directory can prevent the execution of a file for example if you are sure that a file's permission is correct start looking at the directory it's in and then look at that directory's Parent Directory and work your way all the way towards the root of the file system the permissions are set to 755
on this directory and if I look in the directory I see one file and that is an executable File and it currently works so let's change the directory permissions on my C at to [Music] 400 and now I only have read permission I don't have write or execute permission on that directory you can see that the only information I get from LS is the file name that is in that directory because of the re permission since the permissions are set improperly On the directory I can't even execute the file that's in that directory let's change
the permissions to give me execute permissions on that directory and now we see that it works and you can also see that ls- L works the file creation mask is what determines the permissions a file will receive when it's created if no mask were used then the default permissions would be 777 for directories and 666 for Files the file creation mask is typically set by System administrators to some sane default however it can be overridden on a per user basis by using the umask command the umask command sets the file creation mask to the mode
that you pass to it if you use a-h capital s that means um mask will display and accept symbolic notation the mode Supply to umask works in the opposite way as the mode given to chamod so when you give Chamod 7 that's interpreted to mean read write and execute permission or all permissions however when you supply 7 to umask that is interpreted to mean no permission or all permissions off so you can think aam mod is turning on or adding and giving permissions while umask turns off subtracts or takes away [Music] permissions a quick way
to estimate what a umask mode will do to the default permissions is to subtract the octal Umask mode from 777 in the case of directories and from 666 in the case of files for example let's take a um mask of 022 if we subtract that from 777 we are left with a default file creation mode of 755 for directories and 666 - 022 is 644 so for files the default file creation mode is 644 if we use a umask of 002 then we'll have the default permissions for Directories of 775 and 664 for files using
a um mask of 00 2 is ideal for working with members of your group since the permissions allow members of the group to manipulate those files and directories that you create again this method of subtracting these permissions is an estimation so here's an example of using a umask where this breaks down a little bit so umk 007 if you subtract that from 777 you're left with 770 for directory Permissions which is fine however 666 - 07 would leave you with 66 -1 so there is no negative-1 permission there's just no permission so it breaks down
a little bit but it gives you a good idea of what to expect here are some fairly common um mask modes 022 02 077 and 07 this table contains all the resulting permissions created by each and every One of the eight umask permutations if you were to run umask without any arguments it will display the umask in four characters instead of the three that we've been working with the three characters we've been working with represent user group and other however there is one other class and this class is considered special modes and these special modes
are set uid set G and sticky just know that these special Modes are declared by prepending a character to the octal mode that you normally use with umask or chamod so the important Point here is to know that UMass 0022 is exactly the same as UMass 022 or chamod 0644 is the same as chamod 644 we're not going to cover these special modes in this course but I wanted you to be aware that one they exist and two they're the reason why um mask is displayed in four characters Instead of three you can see that
our umk is set to 0 [Music] 022 using a capital S we can get symbolic mode Let's see what the default permissions are the touch command either creates a file if it doesn't exist or it updates the timestamp of uh of a file so we see the directory was created With 755 permissions and the file 644 let's set UMass to 007 oops and um mask of 00007 is the same as 007 and in this case we can see that directories are created with 7 s0o permissions and files are created with 6 60 permissions permissions can
be represented by symbols or numbers the effect permissions have on Directories is slightly different than they have on files we talked about how to change permissions with the chgrp command we talked about some strategies of working with members of your group and finally we covered the file creation mask and the umask command in this lesson we'll look at different ways to display the contents of files and how to use use the Nano editor you can use the cat command to Display the entire contents of a file the more command will allow you to browse through
a file or page through a file the less command is like more except it has more features less is more when using the commands more or less use the space bar to advance to the next page use the inner key to advance one line and type Q to quit viewing the file the commands are based on the vi editor which we'll be covering later in this lesson by default head and tell only Display 10 lines so if you wanted to see the last 15 lines of a file for example you could use tail space D15
space the file name the cat command can be a fine way to view files that have static content however if you're trying to keep up with changes that are being made to a file in real time cat's not your choice you should use tail space- F followed by the file name you would use this to look at files that change often for example log Files you may want to start a program and look at the program's log file to see exactly what it's doing again in this case use tell space- F and the file you
want to follow let's look at this file with a cat command if we run head against that file we will see the top 10 lines of that file if we only wanted to see the top two lines we could [Music] run-2 and the tail command will display the last 10 lines in that file let's say we only want to look at the last line we could do ta-1 and that's the last line of the file let's run more against this file here we can see some information it's the first page of the file if we
want to get to the next page just hit the space bar uh space bar again for another page If you want to go down just one line hit the enter key it's one line another line another line and to quit you just type Q the last command is very similar again space bar goes down a page the inner key down one line and Q to quit now this file is growing so let's take a look at this we'll use DF with tell to follow the file and as you can see the file is being written
to and the screen gets updated with that information as the File grows to exit just typ contrl C if you need to edit a file right now and don't want to spend any time learning an obscure editor use Nano Nano is a clone of Pico so if for some reason the Nano command isn't available triy Pico it's very easy to learn but it's not as advanced as some of the other editors like VI or emac let's edit this file with Nano Nano file. Text so when you start Nano you can see the files contents and
a list of commands at the bottom of your screen the carrot symbol represents the control key so if we look in the bottom left hand corner we see carrot X which means crl X to exit I'll do that now contrl X and we are exited out of Nano let's go back in editing with Nano is pretty easy arrow keys work as you would expect down right up Left if you want to save a file hit crl o and hit enter let's make some modifications so again just place your cursor wherever you want to go and
start typing there and contr X to exit and it says do you want to save your changes or not in this case we'll say no we'll go back in again and another important thing to point out is contrl g to get help and this will show you more information about how to use Nano there are various commands you can use to display the contents of files including cat head tail more and less the Nano editor may not be extremely powerful but it is easy to use and you can learn it in a very short amount
of time in this lesson we'll be talking about how to use the vi editor while Nano is great for simple edits VI and emac have more advanced and Powerful features there will be a learning curve To using these editors as they're not exactly intuitive learning VI will definitely Al be harder than say learning Nano it will require a bit of a Time investment to become proficient to use the vi editor simply type VI space and the file name that you want to edit you can also use VI space file name VM stands for Vi improved
it's compatible with all the commands found in VI however it has some additional features like syntax Highlighting and the ability to edit files over the network on many Linux District distributions when you type VI you are actually running viim or VI improved if you want to view a file but make sure you don't change any of its contents you can use the view command I'd like to point out that an advantage of using VI is that it's always available on a Linux system another Advantage is that once you learn the key mappings for Vi you
Can apply them to other commands like man or more or less or view or you can even use VI mode for editing shell commands VI has the concept of modes you are always working in one of three modes command mode insert mode or line mode when VI starts you are placed into command mode to get back to command mode at any time simply hit the Escape key letters typed while in command mode are not sent to the file but they are interpreted as commands command mode Allows you to navigate about the file perform searches delete
text copy text and paste text here are some of the commonly used key bindings for navigation and command mode K goes up one line J down H left L right one character to move right one word w b moves back one word or left one word the carrot symbol takes you to the beginning of the line while the dollar symbol takes you to the end of the line this graphic shows how the h j k A and L Keys Act as the arrow keys in VI in order to insert text in a file enter VI's
insert mode do this by pressing lowercase i uppercase i lowercase a or uppercase a lowercase i inserts text at the current cursor position capital I inserts text at the beginning of the line a appends after the cursor position capital A appends to the end of the line to use VI's line mode begin a command with colon for example to write the file or save the file type colon W enter to Force a file to be saved type colon W exclamation mark to quit colon Q to force quit colon Q exclamation mark to save the file
and quit or write and quit colon WQ exclamation mark and colon X is the the same as WQ line mode can be used for navigation too if you want to go to line 15 in the file type colon5 enter to go to the last line of the file type colon dollar sign if you want to see line numbers type colon set space Nu and to turn off line Numbering colon set space no n you to get help type colon help and the command that you're interested in again the modes in VI are command mode which
you can enter by hitting the Escape key insert mode by using I or a and line mode by beginning commands with a colon character you can repeat commands in VI by preceding them with a number for instance if you would like to move the cursor up five lines simply type 5K if you'd like to insert a piece of Text 80 times type 80i and start entering the text once you are done you hit the Escape key to return to command mode and the text you type will be repeated 80 times this simple feature alone already
makes it much more powerful than the Nano editor while in command mode you can use x to delete a character DW to delete a word DD to delete a line and capital d to delete the remaining text on the line to replace text Type R for just one Character CW to change an entire word cc to change an entire line line C dollar sign to change the text from the current position to the end of the line you can also use capital c for that the Tilda command reverses the case of the character to yank
or copy the current line type y y to yank a position type Y and a position character for instance to yank a word type y w if you want to repeat this you could yank three words with y 3 w P will paste the most recently deleted or yanked text the undo command in VI is U and the redo command is controlr to start a forward search type a forward slash and a search pattern and hit enter to go to the next match Type n to go to the previous match type capital N to start
a reverse search use the question mark followed by a search pattern and then hit enter let's use VI to edit a file you'll notice at the bottom of the Screen you see a series of till days these represent lines that are beyond the file so we start out VI and command mode and we can use the J key to navigate Down K goes up L to the right H to the left carrot symbol goes to the beginning of the line and the dollar sign goes to the end of the line if we want to enter
insert mode we can use lowercase i to insert text at The current position Escape will take us back to command mode to insert text at the very beginning of the line shift I for capital i um to append we'll just use a and then to append to the end of the line is shift a to delete some text we can use the X to delete a character and if we want to delete a word we can use DW and D D will delete a line and a d capital D will delete from the current position
to the end of the line to replace text we can use R I'll replace this can replace an entire word with CW for change word escape to get back to command mode um see DC to change the entire line uh the till day changes the case so if it's lower case it will become uppercase if it's uppercase it will Become lowercase to yank a line y y to paste p do a forward search type the forward slash and then lowercase n to move to the next item and uppercase n to move to the previous item
to do a backward search start with a question mark and to write changes to a file we can use W let's enter some more Text and to quit we can type Q now that there save changes it won't let us stop so we'll just use Q with an exclamation mark to force our quit let's go back in let's use um let's turn on line numbering with set in you and we can go to line 10 by typing colon 10 or line 5 colon 5 iner and we'll quit with Q there's also a tutor that's very
nice you can run V Tutor and follow along and it will take you through some of the commands and features of VI the vi editor is more powerful and advanced than Nano however it's not as intuitive and it can take some time to learn one of the unique things about VI is the concept of mode you're either in command mode insert mode or line mode in today's lesson we'll be learning how to use the emac Editor emac like VI is a powerful editor Some people prefer VI others prefer emac my recommendation to you is to
experiment with the emac editor and the vi editor and see which one your feel more comfortable with you can't make a bad choice to edit a file with emac run emac and provide it the file name that you wish to edit when you look at the emac documentation you'll see C- character This means to hold down the control key while pressing that character for example c-h means to hold down the control key while pressing the H key if you see c-h space t that means to hold P down the control key while pressing the H
key release the control key and then type the letter T when you see M Dash character that means to hold down the meta key The Meta key is the ALT key you can also substitute the Escape key for the ALT Key for example m-f translates to holding down the ALT key and pressing F or pressing and releasing Escape followed by the F key you may need to use the Escape key as The Meta key since alt can sometimes be intercepted by your terminal program for instance if you want to simplify things just always use the
Escape key for the meta key use crl H to get help Type crl X followed byrl C to exit emac crl xrl s saves the file crl HT Will start the built-in tutorial control h k followed by a key will describe that key you can use this to get help on a specific spefic key command or key combination contrl P will take you to the previous line while contrl n will take you to the next line contrl B is to go backward one character contrl f is to go forward one character meta F will move
you forward one word and meta B will take you back one word control a will take you to the Beginning of the line CR e will take you to the end of a line meta less than will take you you to the beginning of the file and meta followed by the greater than symbol will take you to the end of the file to delete a character type control D to delete a word it's metad d contrl k will kill the rest of the current line to kill the entire line just position the cursor at the
beginning of the line and type contrl K in VI yank means to copy in emac yank Means to paste so control Y is to yank or paste from the previously killed text to undo type crl x u crl s will start a forward search type the text you're looking for and type contrl S again to move to the next occurrence of that text press enter when you're done searching controlr starts a reverse search like VI emac provides a way to repeat commands for instance to kill three lines of text typ crol u 3rl k Let's
edit a file with emac we'll do file. text to navigate we can use crl n to go to the next line and crlf will go forward one character contrl P will go previous line contrl B will go back a character to get to the beginning of the line typ crl a and to the end contrl e and you can just start typing text wherever your cursor is so let's delete a character with Control D to delete a word type metad D again I can use alt D or Escape D let's kill line of text with
contrl K and I'll move to the bottom of the file and yank it or paste it in let's start a search let's search for the contrl S will take you to the next occurrence and then when you're done you can just hit enter and if we do a reverse search we can do that with contrl R let's do the same thing contrl R takes you to the previous one and when you're done you can hit enter to exit crl xrl C and I'm not going to save my changes let's get back into emex again and
we can save the file with crl xrl s again to exit crl xrl C emac is a more powerful editor than Nano emac is also an alternative for Vi again Some people prefer VI others prefer emac I suggest you try them both and see what you feel comfortable with I also suggest that you take the tutorial by starting emac and pressing CR HT [Music] in today's lesson we are going to talk about two commands that can help you find files and directories the First Command we are going to cover is the find command you supply
a path to find and a Search expression and fine will return the results that match the path and expression if you don't tell find what to look for it just returns all the files that are in your current directory and all the subdirectories below that directory you can give find a search pattern by using the dash name option and find will return all the files and directories that match that pattern if you use- iame that tells fine to ignore case if you provide the- LS option to Find it will run a ls- l a long
listing format display of the files and directories that it finds you can search for files by modification Time by using the- M time option defined you can also search for files based on size using Dash size to find files and directories that were created after another file you can give that file to find with Dash newer if you want to execute a command against All the results that find returns you can use the- exact option or - eex EC you then provide the command that you want to run and in the command with an escaped
semicolon the matching curl braces represent the file or directory that was found by find if you run find without any options it just finds everything in your present working directory and Below that's the same really as running F dot which do represents this directory let's look an spin for something named makeev didn't return any results let's do a case insensitive search- I name name and we can see that there is a file named mdev but it's all uppercase so when using name it matches case when using iame it ignores case let's look in Bend and
find any file that ends in V so star means match anything and we can see that it returns Two results let's look for files that are more than 10 days old but less than 13 days old in the current directory so we can use M time for modification time and those are the files that it returns it's also important to note that you can use multiple options to find at the same time so let's find anything that begins with s and perform an LS on it okay just one file let's find things That are of
size 1 megabytes or greater and we find one result there so this you can use one megabyte one kilobyte on gigabyte Etc so no files that are over a gigabyte in size in in my directory let's find all the directories that are newer than file. text you can see file. text was created on February 15th TPS reports was created on February 16th so it is indeed newer than file. Text so this command will find everything in the current directory find Dot and it's going to execute the the file command against all the search results let's
just run this the file command just tells what kind of file it is it's the best guess as to what it thinks the contents of the file represents the locate command is similar to the find command in that you can tell it what to look for and it will return a list of results that match your search Pattern locate is faster than the fine command the find command looks through the path you gave it and evaluates each and every file and directory and determines if that matches your search pattern or not and then returns those
results the locate command however works off of an index typically the index is rebuilt every day instead of evaluating each and every file to see if it matches the pattern locate just does a lookup in the index what you need to know about This is that the results are not in real time there is a lag between the time that the index gets created and the time that you run the locate command so if you're looking for a file that was created just 2 or 3 minutes ago chances are it's not going to be in
the index your only hope for finding that file is with the find command that evaluates files and directories in real time also on some systems locate is not enabled by Default let's use the locate command to find files and directories that have sales in the name get four results back let's do another example you don't have to specify a full name you can specify a part of a name so let's look for TPS re that returns three results let's create a new file and the touch command just simply creates an empty file now if we
run our locate command Again we can see that the file is not found let's do it with the file's name that's because the index is not up toate let's use the find command to evaluate all these in real time and we'll see that indeed we can find the file with the find command today we talked about the find command and locate command find searches for files and directories in real time find is very powerful and has many Options the locate command can be faster than fine but the disadvantage is is that it's not in real
[Music] time in this lesson we're going to talk about various graphical editors available in the Linux operating system so far you've learned about commandline editors that are appropriate to use when you connect to a server via S H or when you're using a terminal emulator application if you're running Linux as a Desktop operating system you also have access to graphical editors emac not only works at the command line but it also has a graphical mode as well gedit is the default text editor for The Gnome desktop environment it's very similar to notepad gvim is the
graphical version of Vim kedit is similar to gedit it's the default editor for the KDE desktop environment if you are looking for a Microsoft Word replacement consider Abby word or Libre office Libre office not Only includes a word processor but it's a complete office suite it contains a spreadsheet a database and presentation software if you're looking for a source code Editor to help in computer programming look at an editor like Kate there are other options available like Genie or jedit or even Sublime Text this is the cnos Linux distribution with a gnome desktop environment let's
look at the default text editor for Gnome which is Gedit it's a fairly simple text editor but it gets the job done I'll open up a [Music] file click on save to save and we'll go ahead and close out this program emac also has a graphical mode all the key Bings work like they do in the command line mode but with a graphical mode you also have access to a menu and a Toolbar so just like the other text editor we can open up a file and like control e will work to take us to
the end of the line like we were in command line mode do file and save let's look at the graphical version of [Music] themm again the keystrokes that work on commandline version of VI also work in the graphical version Type write to write a file I'll even exit with Q Libre office is an office suite let's look at the text editor first it's very similar to Microsoft Word we'll close out this application let's look at the spreadsheet program Cal there's also presentation software there are a variety of text editors and word processors for Linux emac
and VI both have graphical counterparts sometimes you may not have access to a graphical environment for example when you're connecting to a server over ssh in that instance you have to use a command line editor however if you do have access to the Linux desktop and graphical environment feel free to use a graphical text editor of your choice this lesson will cover how to delete copy move rename and compress Files eventually you'll get tired of all the files you have laying around and want to delete some of them to do that use the RM command
RM space file name is the simplest form of this command command if you want to remove a directory and its contents recursively use RM space- R and the name of the directory if you want a force removal use rm- f search patterns can be used to delete multiple files at once it's a good idea To double check what you're going to delete with a LS command before you actually run an RM command against it in this example you can see that rm. star will not move Dot and dot dot which represent this directory and The
Parent Directory to copy files use the CP command if you want to create a copy of a file you just run CP source file destination file you can also copy a file or a series of files to a directory by using CP and then listing the file or Files and ending the line with the directory name to run CP and interactive mode use CP space- I if the destination file exists CP will prompt you before it overwrites the file if you use CP space- R Source directory and destination CP will recursively Copy Source directory into
the destination directory if the destination directory doesn't exist it will create the destination directory with the contents of the source directory let's copy a file with a CP Command we'll copy file one to file 2 and you can see that there are no differences between the files let's create a directory let's copy these files into that directory so we can list as many files as we want and when we end the command with a directory it will copy all those files that we listed into the directory you can see that the files are in the
directory if you use CP with A-i it's interactive mode and it will prompt you if the file exists the destination file exists do we want to overwrite file 2 let's do a recursive copy on dir to di2 dir2 doesn't exist so CP creates di2 and places the contents of di into di2 if we try to copy di into dir3 dr3 does not exist we'll see what happens and we see that copy skips directories copy will only work on directories if you give it a-r for Recursive so let's create di3 let's recursively copy dir and dir2
into D3 and you can see that the two directories are in dir3 to move a rename file use the MV command if you were to run move space Source space destination move will move the source into the destination otherwise Source will be renamed destination like CP MV has an interactive mode so if you were to run Mv- Source destination and destination existed MV will ask you if you want to overwrite the destination let's use the move command to rename a directory you can see that Di has been renamed to First di let's do the same
thing with a file rename file one to file 1. renamed and let's look at how move will handle moving a file into a directory file 1. renamed into first diir and you can see that the file is now in First di this contents of file one this is the contents of file two if we run move file one file two that will rename file one to file two it will overwrite file two you can see file one is gone because it's been renamed and overwrote file two if you want to do this in interactive mode
use- I and in this case it says hey there's a file that already exists do you want to overwrite it or Not you've already used the sort command a couple of times in this course but as a reminder the sort command at its most basic level sorts text alphabetically that appears in a file you can use sort with a-h K option and Supply a field so you can sort by a different field than the first field - R sorts in reverse order and- U removes duplicate lines and only provides unique results let's look at the
contents of more Secrets if we sort this file it will sort on the first column we can see that P comes before s which comes before T Etc you'll also notice that there are two duplicate lines so to remove those we can run sort with a-u for unique and we see that we only get one tags line if we want to reverse the order- r and if if we want to sort by the second Column we can use- K2 for the second field and we could even combine options use the dasu for Unique now you
can see the second field a comes before B before c and before F if you want to bundle a group of files or directories together in an archive use the tar command you may want to create a cop or backup of a group of files you may also have several files that you want to transfer at once or transfer as a set in these situations Tar can help you'll notice that tar does not require a hyphen to precede its arguments The Hyphen or the dash is in Brackets traditionally The Hyphen is excluded but tar still
works with it so if you see tar space CF file. tar it's the same as tar space- CF file. tar some of the most commonly used tar options include C to create a tar archive X to extract files from the archive T to display a table of contents V to be verbose Z to use compression and F to specify the file that you'll be working with let's create a tar Archive of TPS reports directory so tar C for create f for the file we want to use we'll use tps.org to Archive can use T for
list and it shows the directory and two files so let's move into the temp directory and extract the archive extract f for the file we'll Give it the file name and you can see that it extracted the contents into TPS reports if you want to get a verbose listing of what tar is doing you can use a v option so we could have ran tar xvf home jsonp S.T and it will list the files that it's extracting to compress files and save space you can use the gzip command to uncompress the file you'll use G
unzip And if you want to view the contents of a zip archive you can use G zcat or zcat you can use the DU command to display how much dis space is used by a file so du- K displays sizes in kilobytes d-h displays sizes in a human readable format so if the file is 5 megabytes it will say 5m or 3.7 GB 3.7g let's use the DU command to see how much space that this data file is using it's using 80k you can compress it with gzip when you compress a file with gzip it
compresses it and adds the gz extension to the file name let's see if that saved as any space and it did 4K 80 uncompressed 76k compressed we can uncompress it with G unzip we can see it's back to its original state if you want to create a tar archive that is compressed you can use the Z option for compression we'll do c For create F we'll name the file [Music] naming convention you don't have to name files this way sometimes you'll see it tps.org Z but tgz is short for a tar that's been compressed with
gzip we'll compress the TPS reports directory and if you want to work on a compressed file you need to use Z and it lists the files that are in that archive In this lesson we covered the RM command to delete files CP command to copy files the MV command to move and rename files and directories gzip to compress and tar to create archives in this lesson you'll learn what wild cards are when you can use them and the various types of wild cards finally you'll get to look over my shoulder as I run through several
examples of how to use wild cards on an actual Linux system a wild card is a Character or a string that is used to match file and directory names you can use wild cards to create search patterns that when expanded will return a list of matching files and directories sometimes wild cards are referred to as Globs or glob patterns globbing is the act of expanding a wild card into the list of matching files directories wild cards can be used in conjunction with most Linux commands if a command accepts a file or directory as An argument
then you can use a wild card in the argument to specify a file or set of files you'll find yourself using wild cards with commands like LS RM CP MV and others here are the two main wild cards they are the asterisk and the question mark the asterisk or Stars I like to call matches zero or more characters it matches anything by itself it's not really that Useful but when you combine it with other parts of file or directory names that you're looking for it becomes powerful for example we could use star. txt to find
all the files that end in txt if you wanted to list all the files that start with the letter A then use a star if you want to find all the files that start with an A and end in txt then use a.txt the question mark matches exactly one Character if you want to find all the files that only have one character proceeding. txt then use question mark. txt to match all the two-letter files that begin with an a use the letter A followed by a question mark to match all the files that start with
A and then are followed by a exactly one more character and then end in. txt use a question mark. txt you can use something called a character class to create very specific Search patterns start with a left bracket then list one or more characters you want to match and then end with a right bracket for example if you wanted to match a one character long file name that was a vowel you would use bracket a e i o u bracket if you wanted to match files that start with CA followed by either an N or
a t followed by zero or more characters then use c a bracket NT bracket star this pattern will match files named can cat Candy and catch if you want to exclude characters in a match use an exclamation mark for example if you wanted to find all the files that do not start with a vow use bracket exclamation mark a e i o u bracket Star Baseball and cricket match this pattern because the first character is not an a e i o or a u when using character classes you can create a range by separating two
characters with a hyphen if you want to match all the characters from a to G use bracket a Hyphen G bracket if you want to match the numbers 3 4 5 and six use bracket 3 hyphen six bracket instead of creating your own ranges you can use predefined named character classes these named character classes represent the most commonly used ranges Alpha matches alphabetic letters this means it matches both lower and uppercase letters Al nuum or Al num matches alpha numeric characters this means it matches Alpha and digits said another way it matches Any uppercase or
lowercase letter letter or any decimal digits digit represents the numbers in decimal from 0 to 9 lower matches any lowercase letters space matches white space this means characters such as spaces tabs and new line characters upper only matches uppercase letters what if you want to match one of the Wild Card characters then you would Escape that character with a backslash to escape the wild card simply Place The Backs slash before the wildcard character if you want to make your life easier don't name your files with question marks and asterisks however you may end up receiving
a file with these characters in them so you'll need to know how to handle them for example if you wanted to match all the files that end with a question mark then use star back SL question mark an example match would be a file named d n e question mark Let's do an LS to get our bearings in see what files and directories we're working with let's use the asterisk or star and match all the files that end in txt LS star. txt what just happened is the shell performed a globbing operation to expand star.
txt and it passed those results to the ls command and this example running LS star. txt is the same as running LS ab. text a.text b. text and songs. text Of course you can clearly see it's easier to use a pattern like star. txt than it is to type out all the files by hand I just wanted to be clear about what is happening when you use wild cards now let's look at all the files that start with the letter A how would you do that that's right type in LS a star now let's find
all the files that start with an A and end and. txt we can do that by typing in LS a.txt Can you see a way that we can make the Wild Card even simpler how about this LS a star T and that gives us the same results let me clear the screen here and reset our bearings look at what we're working with now let's use the question mark Wild Card let's match all the files that are exactly one character in length we'll do that by running LS question mark if you want to display all the
files that are two characters in length then just use two question marks each Question mark represents a single character so we'll do question mark question mark and we'll see that all the two character files and directories are returned in this case they're just files let's list all the files that start with an a then contain exactly one character and end in txt to to do that we'll run LSA followed by question mark which represents exactly one character and then txt let's check out the difference Between the question mark and star let's run LSA star. txt
the star matches zero or more characters so running LS a.txt matches the file named a.txt before we continue I want to point out that you can use the same flags and options as you normally do with a command while you're using wild cards let's get a long listing of all the files that start with the letter A so just like we normally would use with ls To get a long listing we'll use- L and then we'll use a star to get every file and directory that begin with the letter A go ahead and clear the
screen again here here's an example of using a character class let's match all the files that start with the letter c then contain a vowel and end n t to do this we'll run LS C bracket and then any of the characters or excuse me all the characters we want to match AE i o u and Then T and I want to point out too that it doesn't matter what order the characters appear in in the bracket so we can use E I O Au and we'll get the same results let's do another one here
um still get the same results let's use a range this range will match all the files that start with an A B C or D to do that we'll do LS bracket A- D to represent a through d and Then Star here's an example of using a named character class this command will return a list of files that end in a digit I've simply been using the ls command to demonstrate how to match files using wild cards but let's do a little bit of actual work with wild cards let's clear our screen and run LS
again to see what's in our directory let's move all of the text files into the directory named notes to do this we can use the MV command to Move and then we'll use star. text to match all the text files and we'll end with the directory name which is notes and let's see if that worked okay I'm not seeing any of the files that end in txt let's look in the notes directory and see if they're there and indeed they are let's MO move all of the MP3 files into the music directory we can do
this in a couple of different ways one way would be to run mv. MP3 and specify the Songs directory we can also use star three since that would match and we can even use a character class like uh star and then digit I'll go ahead and just use mv. MP3 to perform the match let's look inside the music directory and we can see that the two MP3 files that match our start at MP3 uh expression are moved into the music directory let's use wildcards to delete some files here's a good pattern to follow test your
wild card pattern with The ls command before you use that pattern with the RM command this way you can hopefully avoid deleting any files that you do not intend to remove let's remove move all the files that are two characters in length we'll check our Wild Card pattern here to make sure it Returns what we want to do and it looks like it does so we'll go ahead and run RM using that same expression and now the files that match that pattern are Gone today you learned how to use wild cards you learned that the
estri matches zero or more characters you also also learned that the question mark matches exactly one of any character you learned about character classes and how you can match any character that is included between the brackets you were taught about ranges and how you can create your own custom ranges by starting with a character following it by a hyphen and then ending it with another character Finally you learned about the various named character classes and how they can be used to match common sets of characters such as digits uppercase letters and lowercase letters in this
lesson we'll be talking about the different types of IO input and output and how to redirect that IO there are three default types of input and output they are standard input standard output and standard error by default standard input comes From the keyboard and standard output and standard error are are displayed to the screen each one of these IO types is given a file descriptor file descriptors are just numbers that represent open files for us humans it's easier to reference files by name but it's easier for computers to reference them by number you might be
thinking my keyboard isn't a file nor is my screen on one level that's true but on another level it's not Linux represents practically Everything as a file this abstraction allows you to do some powerful things like take the standard output of one command that would normally be displayed to your screen and use it as the input to another command or even redirect that output to a file use the greater than sign to redirect output and the less than sign to redirect input the greater than sign redirects output from a command to a file while The
less than sign redirects input from a file to a command the explicit way of using redirection is to provide a file descriptor number however if one is omitted then the file descriptor zero is assumed for input and one for output redirection when you use two greater than signs the redirected output will append to the file normally with redirection a file follows the redirection operator if you want to use A file descriptor instead of a file name use the Ampersand symbol so instead of redirecting standard error to a file with 2 greater than out. err for
instance you could redirect it to standard output with 2 greater than m 1 this effectively combines standard input and standard output if you want to ignore output you can send it to the null device which is Dev null the null device is a special file that throws away whatever is fed to It you may hear people refer to this as a bit bucket if you don't want to see errors on your screen and you don't want to save them to a file you can redirect them to devnull for instance let's look at the output of
the LSL command let's redirect that standard output to a file use the greater than symbol and follow it with a file name let's use files. text so if we look at the contents of files. text we'll see that it has the Output of ls- L you can append to an existing file with two greater than symbols so let's take the standard output of Ls and append it to files. text we can see that this is the ls- L output from earlier and then at the bottom is just the ls output input redirection works like this
let's take files. text and redirect the contents into sort and you see that sort was run on The command this is really equivalent to sort files. text but this is another way to do it file descriptor one is assumed for output redirection and file descriptor 2 is assumed for input redirection so this is the same ls- L to files. text is the same as l-l one the file descriptor number to files. text however make sure you don't leave a space if you're going to use this input and output redirection can be Combined so let's use
files. text as the input for sort command and let's redirect that output to sorted files. text and you can see that that worked when a program encounters an error it reports its findings on standard error file descriptor one is for standard output while two is for standard error file descriptor one is a default descriptor for output redirection so this can mean that not all of the output generated by a program is captured by Default let's look at this example you can see that this command found files. text but it also had an error the file
not here was not there let's run the same command again so in this situation file descriptor one standard out was redirected to the file called out standard error was not redirected so it was displayed to our screen can see that standard out did go to Out let's redirect standard error into out. err so standard output came to our screen standard error went to this file this can actually be handy because you can send standard output one place and standard error to another so let's do that that's standard out and this is standard error and you
could use that for an error log for instance you can also combine standard output and standard Error let's do that redirect output to out. both take standard error and appendant to standard input so both the error message no such file directory and the standard output of files. text ended up in out. both let's use the null device if you want to ignore errors you can send the errors to devnull or send stand standard output to devnull and then now you just get the error message or you can do Both redirect output to Dev null append
standard error to standard output this lesson covered standard input standard output and standard error the default file descriptor for standard input is zero while standard out is one and standard error is too you can redirect input and output with greater than and less than symbols if you want to use redirection in conjunction with file descriptors use in Ampersand you can redirect output to Devnull to prevent output from being displayed to your screen or written to a file this lesson will cover how to compare the contents of files if you want to compare two files and
display the differences you can use the diff command the SD command or Vim diff the diff command will display the differences between two files while the sff command will display the differences with file one on the left and file two on the right Vim diff will use the VM Editor to display the differences between two files here is just the first line of output produced by diff the first number represents line numbers from the first file F and the second number represents line numbers from the second file the middle character separating the line numbers will
either be a c which represents a change D which represents a deletion or an A which represents an addition in this example the third line of the first file is Changed or different than the third line in the second file this is an example of an entire output from the diff command the output that follows the less than sign belongs to the first file the text folling the greater than sign belongs to the second file the three dashes are just a separator in the stiff output the pipe or vertical bar character means that the text
differs in the files on that line you may also see the less than sign Which means that the line only exists in the first file the greater than sign means that line only exists in the second file when you run Vim diff both files will be pulled up in separate windows to switch between the windows type control ww to close the current file in the current window type colon Q enter if you want to close both files at once and quit type colon QA and if you've made Some changes that you don't want to save
you can type colon QA exclamation mark enter we'll use the dashin option for the cat command to display line numbers let's use the diff command to look at the differences between those two files you'll notice that the line that begins with the less than symbol belongs to the first file while the line with the greater than symbol belongs to the second file you'll also notice the first line of diff output says four C4 that Means the fourth line of the first file is changed or different than the fourth line of the second file let's use
FD and you can see that it places the files side by side and the vertical bar or the pipe symbol displays the line that has a difference let's add a new last line to this file we'll append it and we'll run S again and this time you can see that the less than sign represents that there is a line in the first file that is not in the second file we'll use Vim diff you can see that Vim is highlighting the differences between the files you can use control ww to move between Windows and if
you want to close one window Q colon Q to close the other Window let's do that again and we'll close both of them at the same time can look at the differences and colon QA enter to exit Vim diff in this lesson we covered the diff command which displays the differences between two files the SD command which does the same thing except for a displays the differences side by side and the Vim diff command which displays differences in the Vim editor in this lesson we'll be covering How to search the contents of files as well
as what pipes are and how to use them to look for text within a file use the grap command the typical format of the command is grap space a search pattern space the file that you're searching for the pattern in here are some options that you can use with the GP command-i will perform a case in sensitive search- c will display the number of Occurrences that it finds in a file dasn will proed the output with line numbers and- V will do an invert match this returns lines that do not match the search pattern let's
look at the contents of this file let's search in this file with a GP command you can see that it'll return all occurrences that it finds that match that pattern so o is contained in Facebook and O is also contained in Jason so grap returns those two lines if we want to do an inverse match we'll do a-v or invert the match and we'll display all the lines that do not contain the letter o you can see that it's matching case to ignore case use- I so now it will return the line with lowercase user
can also combine options we'll do c for count and ignore Case and grap says there's only one line that matches user and using dashn will'll display which line number that the match occurs on there are some Clues as to what a file might contain for instance some files will have an extension if a file ends in txt chances are it's a text file if a file has executable permission set it might be an executable program an easy way to determine the type of a file is to run the file command against that File if it's
a text file it will say that it's text in the output of the file command a binary file is a file that is in machine readable format and not a human readable format if you run GP against a binary file it will simply display whether or not that information was found in the file but it will not display the text to look at the textual data within a binary file use the strings Command the vertical bar is called a pipe you can change two commands together with a pipe pipe takes the standard output from the
preceding command and passes it as the standard input to the following command if the First Command displays error messages those will not be passed to the second command by default error messages are displayed on standard error if you want standard error to be passed in as input to the Command following the pipe you can redirect standard error to standard input how to do that was covered in the I redirection lesson here is a common pattern that you'll see often in Linux there are several commands that allow you to specify a file on the command line
that is to be used for input with grep for example you can run grep followed by the pattern Then followed by the file to use as input if you don't Supply a file name Then the command will use standard input grap pattern file is the same as cat file pipe graph pattern that's because cat displays the contents of the file on standard output the pipe takes the standard output from the cat command and passes it in as a standard input to the grep command since no file name was specified for grep to act on it
takes standard input as its input the cut command allows you to select portions of a file or to cut out Pieces of a file like grep if file is omitted cut will use standard input the the- D option for cut allows you to specify a field delimiter DF tells cut which field to display let's look for the string John and this file and we can see that grap tells us two pieces of information that it does find that string in that file and that that file is a binary file the file command reports that it's
an Audio file and it doesn't say anything about text so it's not a text file you can see that there are a lot of strings that are just not human readable to just display the strings that are human readable we'll use the strings command and then we can run our search on this strings Giant Steps and now we can see the actual data that the GP command initially found the output of the strings command is sent to The input of the GP command because we're using a pipe to chain those two together pipes aren't limited
to two commands you can chain as many commands together as you want so let's take the output that is formed by those two commands and then pipe it into let's say head-1 to display the first line of output from grap just going to hit the up Arrow key to repeat that let's use the cut command let's use space as a Delimiter and let's print the second field and that will just give us cold train let's say we want to find all users named Bob in the Etsy password file the Etsy password file just contains a
list of all the accounts on the Linux system we want to print each account name and their real name but no other data we want to print them in alphabetical order by account name and we want to display them in a tabular format let's look for Bob and Etsy Password and what we want to do is print the account name and real name however there's other information in that file so we can use the cut command to get the information we want for example it looks like the fields there are fields that are separated by
a colon so we can use- D and use the colon as a field delimiter and the first field and the fifth field contain the information that we want so we'll use- F1 comma 5 we also want to sort them in alphabetical order so the sort command can take care of that for us and we want to get rid of the colon character so we can use a command called TR that translates character so we'll translate the colon character into a space character and we want to display this information in a table format so we can
use the column command with a-t for Table and that gets us the result we desire another common use of pipes is to control how output is displayed to your screen if a command produces a significant amount of output it can scroll off your screen before you have a chance to view it to control the output use a pager utility such as more or less you've already used these commands already on files directly but keep in mind that they can take a redirected input as Well let's look at Etsy password and the contents of that file
scroll past our screen so we can use the less command to page through that file and Q to quit so cat Etsy password pipe less is really the same as less Etsy password and that's kind of how we've been using it up to this point however if you do something like this let's look for bin and Etsy password that Scrolls past our screen so We can pipe that to less so this is a situation where you couldn't use less directly on a file however using the standard output of a previous command as the standard input
for the less command is helpful in this lesson we learned how to search the contents of files using the grep command how to determine a files type using the file command how to cut out pieces of a file using the cut command how to translate characters with the TR command and how to format output Into columns with the column command we also talked about the commands more and less which are pagers the important thing to note here is that there are many small commands that do one thing well and that you can chain them together
using pipes to do something very powerful and useful in this lesson we'll be covering how to copy files over the network you already know how to copy files from one location to another on The same system using the CP command and but if you want to copy files from your local workstation to a Linux server or between Linux servers you need to use SCP or SFTP SCP is secure copy and SFTP is SSH file transfer protocol sometimes SFTP is referred to as secure file transfer protocol SCP and SFTP are both extensions of the secure shell
protocol in order to use SCP or SFTP you Need a client Mac and Linux come with SCP and SFTP command line utilities if you are running Windows you can use the putty secure copy client PS cp. exe and the putty secure file transfer client psftp exe there are graphical clients as well cyberduck is popular for mac and windows filla runs on Mac windows and Linux when SCP is a Windows only SCP and SFTP client if you are looking for a more interactive experience where you can Examine the local files and remote files use SFTP with
SCP you need to know what files you want to transfer before issuing the command SCP and SFTP aren't the only ways to transfer files to remote systems sometimes FTP called file transfer protocol is enabled in such cases you can use the built-in FTP command line client on Linux and Mac or graphical client like when SCP for Windows just be Aware that FTP is not a secure transfer protocol like SCP and SFTP this means that your login credentials are sent in plain text over the network also the files that you upload and download are not encrypted
either if given the choice between SCP SFTP or FTP pick SCP or SFTP let's use our SFTP client to connect to this Linux server when you connect to the remote server you're placed into your home Directory and LS will show the files that are in my home directory if you proceed those commands with an L that's for local so lpwds that I'm in the local temp test directory and L l s will show what files are on the local box in temp test so let's put z. text onto the server and we'll do an LS
and we can see that z. text shows up on the remote server let's delete it off the remote server and let's do an LS with A-L for a Long listing and see if it's gone and it is so we'll quit our SFTP client with SCP you can copy from your local system to the remote system but you need to know the source and destination so our source file will be z. text our destination will be Linux svr1 append a colon at the end of the server name followed by a path name uh we could put
this file in the temp directory on the remote server oops I misspelled That we could put this file in say our home directory uh Tilda is a shortcut for home and let's connect to the Linux server and show that we did place zext there and also in temp let's transfer this file to the remote server as a different user let's use admin user at Linux server and we'll place this in the admin users home directory again we can use Tilda as a shortcut for home or we can even specify The full path let's just do
that and let's connect it's the same with SFTP let's connect to uh SFTP admin user at Linux server and then you can see that z. text was was transferred let's look at using a graphical client like filezilla to connect via SFTP type SFTP colon colon and then the IP address or server name and give a username and password and click quick Connect if you get prompted about an SSH key go ahead and accept it and this is a one-time thing on the left side you see our local files on our workstation and on the right
side are the remote files on the Linux server we'll just pick a file to transfer up to our Linux server let's put it in our desktop folder and you can drag and drop a file from local to remote also from remote to local and you can also do a transfer by Double clicking the file as well let's log into our Linux server and see if those files got transferred like we expected and we can see that the file is on the desktop double click to open yep it made it let's look at our documents folder
and we can see the file is there as well to transfer files over the network you need a client there are command line clients like SCP SFTP and FTP you can Also use a graphical client such as cyberduck filezilla or when SCP if you have a choice to use FTP or SFTP choose SFTP this lesson will cover how to customize your shell prompt as you've seen earlier in this course default prompts can vary from system to system no matter what shell you're using you can customize your prompt by setting an environment variable for shells like
bash ksh and Sh the environment variable PS1 is used to set the primary promp string for shells like CSH tcsh and zsh they use the prompt environment variable the format string you place in the environment variable determines the look and feel of your prompt each shell uses slightly different format strings so consult the documentation for the shell that you're using let's look at customizing The Bash prompt since bash is the most popular default shelf for user accounts on Linux Systems these are some of the most commonly used formatting string options for bash /d will give
you the date in the weekday month date format slh will give you the host name up to the first dot or the short host name a capital H will give you the fully qualified domain name of the server sln will give you a new line so you can have a multi-line prompt SLT will give you the current time in 24hour format while SL capital T Will give you the current time in 12h hour format an emper San will give you the current time and 12-hour format with AM and PM included SL capital A will give
you the current time and 24-hour format just using hours and minutes SLU is the username of the current user slw is the current working directory / capital W will give you the base name of the current working directory instead of the Full path SL dollar sign will let you know if you're a normal user it will display a dollar sign or if you're the super user or root account it will display a pound sign for a complete listing of all the formatting options see the bash man page to make your customized shell prompt persist between
logins add the PS1 value to your personal initialization files personal initialization files are commonly referred to as dot files since They begin with a DOT or a period you could also use Nano VI or emac to edit your- bashore profile file this example just uses Echo to accomplish the same thing let's look at our current prompt string and let's change it in some way let's set it to username at host and you can see that it's customized now let's add the time to our prompt and the working directory too and the Tilda you can see
represents Our home directory let's add let's go to Bar log so you can see that bar log is the current directory and let's use base names for directories this time with a capital W now you can see that even though we're in /var log it only says log let's go back to our home directory if we want to persist changes between logins we need to put these in our Personalization file so let's edit bash profile set this environment variable we'll just set it to this to show that it's going to work we include our username
the host we're on the directory we're in and a dollar and now you can see that the prompt is retained between logins let's do one more thing let's make a multi-line prompt we'll put time on one line and let's put post and working directory on The next line clear the screen here and you can see that every time that we hit enter we get a new prompt with the current time on one line and a normal looking prompt on the second line shell prompts can be customized by setting an environment variable this can differ from
Shell to Shell a lot of shells use PS1 others use prompt to save your custom shell prompt between logins you need to add that environment Variable setting to your personal initialization files such as bash profile this lesson covers creating deleting and persisting aliases if you find yourself typing the same command over and over again you can create a shortcut for it called an alias an alias can be thought of as a text expander creating aliases for commands that are really long or that you use often is a common practice for example If you type ls-
L frequently you may want to abbreviate it to LS L as a matter of fact this Alias often comes predefined in many Linux distributions the Alias command can list or create aliases if you run Alias without any additional information on the command line it displays the list of current aliases that are set if you want to create an alias use Alias space the Alias name equals and the value for that Alias aliases don't have to be used for Just shortcuts they can be used to fix common typing errors for example if you end up typing
grp when you mean to type G you can create an alias and whenever you accidentally type grp Alias will fix that for you and spell it g p you can also use aliases to make your work environment similar to that of another platform for instance in Windows CLS clears the screen but in Linux the equivalent command is clear you could create these shortcuts to make you feel More at home to remove an alias type unalias and the name of the Alias or to remove all aliases use unalias space- a if you were to create some
aliases and log out and back in your aliases would be lost to make them persist between sessions add them to your dot files such as bashore profile the downside to creating several aliases is that when you're on a system that does not have your aliases you Might feel lost if you want to be able to work effectively on any Linux system that you have access to keep your Alias usage to a minimum another way to handle the situation is to Simply copy your configuration files to each Linux system that you're going to work on let's
say you run ls- l a lot let's make this an alias make it shorter let's Alias LL to be ls- l so now when you type LL you'll get the same result as ls- l Let's say you like to type CLS because you come from a Windows background CLS is not available on Linux the equivalent command is clear you could create an alias for CLS that equals clear so now when you type CLS it will clear the screen to list aliases just use the Alias command to make them persist you can add it to your
bashore profile file let's do this let's add my CLS you can see that that's not set Let's log out and log back in and you can see that my CLS is set the Alias command lists and creates a aliases while the unalias command deletes aliases to persist your aliases between logins add them to your dot files if you are finding value in this course I want to invite you to leave a five star review in the top right hand corner of your screen click on write a review click the star on the right if You
want to you can leave some comments but it's totally optional thanks for your review not only does it encourage me to keep the content of this course up to date and even create more resources for this course but it also helps others like you find this content thank you so much in this lesson you'll learn what environment variables are what they do and how to create as well as delete them an environment variable is a storage location that has a name and a value They often affect the way programs behave for example in earlier lesson
you learned how to tell various programs about your preferred editor by setting the editor environment variable the easiest way to view all the environment variable names and values is to run the print EnV command without any arguments on your screen you can see an example of this each line contains the environment variable name followed by an equal sign and then the value of that environment Variable for example the environment variable host name is web 01 since that is the host name of the system that I was logged into when I ran this command this is
an example of an informational environmental variable another example on your screen is the path environment variable this is an example of where the value of the variable affects how a program behaves in this case the shell uses the path to determine what paths to look for commands to execute and in what Order if you change the path environment variable you change how the shell operates if you want to look at the value of one specific environment variable you can pass its name as an argument to the print EnV command if you were to run print
EnV home then only the value of the home environment variable will be displayed just like most things in Linux environment variables are case sensitive if you were to execute the print EnV command followed by home and All lowercase letters nothing will be returned because there is no environment variable named home in lowercase letter Letters by the way environment variables are uppercase by convention you can create lowercase environment variables but you will rarely see that another way to display the contents of an environment variable is to use the echo command with this method you need to
prein the dollar sign to the environment variable name if you want to look at the Contents of the home environment variable you can run Echo space dollar sign H again environment variables are case sensitive so so trying to Echo the value of dollar home in all lowercase letters will not return a result when you create an environment variable use the syntax of export followed by the environment variable name followed by an equal sign and finally the value you want to assign to the variable in quotations do not use Spaces around the equal sign if you
do use spaces you'll get an error run export space editor equal sign quotation mark V quotation mark to create the editor environment variable and assign it the value of VI some commands look at the editor environment variable to know which Editor to start by the way if the editor environment variable already existed this would overwrite its contents so this is not only how you can Create an environment variable it's also how you can update an existing one another example is setting the TZ variable here running export space TZ equal sign quotation Mark us SLP Pacific
quotation mark sets the time zone to us specific time the date command for example will return a different result depending on the value of the TZ variable let's say you no longer need or want an environment variable to remove it from your environment run the unset Command followed by the environment variable name for example let's say we want to rely on the default time zone of the system instead of overwriting that with a TZ environment variable so we remove it by running unset TZ the act of setting and unsetting environment variables from the command line
affects your current running session only if you want to make your settings persist between logins you'll want to Define your environment variables in your Personal initialization files like the bashore profile file you use the same syntax as you learned so if you want to explicitly set your time zone then you can add an export TZ line in your bashore profile as shown on the screen if we want to see what environment variables are configured we can run the print EnV command if there are too many environment variables and they scroll off your screen you can
pipe the output To a pager utility like less now I know what environment variables are configured in my environment if I want to look at the value of just one of those variables I can use print EnV or Echo let's look at the path so we can run print EnV path which will display the contents of that environment variable or we could use the echo command Echo and this time we're going to prepend the environment variable name with a dollar sign so Dollar sign path will return the path let's look at the current time with
the date command now let's set our time zone by changing the TZ envir enironment variable set this to us specific time and I'll run date again and then now you can see it's 11:14 instead of 1414 because in the Pacific time zone it's currently 11:14 a.m. now let's try removing the TZ environment variable and CFR time zone is set back to the Default now when we run the date command we're back in the US Eastern Time Zone because that's the default set on this particular server let's say that we always want to display the time
in the US Pacific time zone to make this setting persist we're going to add it to our bash profile file so I'm going to use the vi editor because that's my favorite editor you can use Nano emac or whatever editor you like and then I'm going to edit this file bashore profile In my home directory and then I'm just going to go to the bottom and do an export here export TZ equals US Pacific and now I'm going to write and quit save my changes I'm going to log out of this system there we go
and now I'm going to connect back in So now let's see if the time zone variable is set we can do Echo dollar sign TZ and sure enough it's set to us Pacific and if I run the date it is in Pacific time as well by the way you Usually can tell what environment variables a program uses by looking at its man page in the environment section let's do that now for the date command so if I run man and the command which is date hit enter and I can look through the man page here
and if I get down to the the section here called environment I will see it has one environment variable listed which is capital TZ which is the environment variable we've been working with and it says here that It specifies the time zone unless overridden by command line parameters this is how you can tell what impact an environment variable will have on a given application in this lesson you learned that environment variables are name value pairs that can affect the behavior of an application you also learned how to view your environment with a print EnV and
Echo commands Additionally you learned how to create or update environment variables using The export syntax we talked about removing variables from your environment with the unset command next you learned how to make environment variables and their values persist between sessions finally we talked about how you can find what environment variables a given program uses by looking at its man page in this lesson we'll be talking about how to list the running processes or running programs and commands we'll talk about the difference between Foreground and background processes and how to manipulate those we'll also talk about
how to kill processes to display the currently running processes use the PS command if no options are specified PS displays the processes associated with your current session to see every process including ones that are not owned or running as you use PS with A- e option the- F option will give you more information in a full format listing to see processes Running as a specific user use ps- you username and to display more information about a specific process use its PID or its process identification number PS space sp- P space PID here are some common
PS commands that you could use ps- e to display all the processes ps- EF to give you a full listing of all the processes there's a couple of different ways to display processes in a tree like output PS space- e with a capital h or- e with a-- Forest option again to display a specific user's process use PS space- space that username there are other ways to view processes and running commands on a system you can use the PS tree command it displays processes in a tree format you can use top which is an interactive
process viewer or you can use htop htop is less common than top so it may or may not be included in your Linux distribution to see a list of processes That are associated with your session type PS and you can see that I only have two processes The Bash process which is my shell and PS which I ran to get the list of processes if we want to look at a specific process we can use- p and Supply a pit or a process ID so let's look at 1530 and that will only list that one
specific Process to get a full listing we can use a-f and that will tell us some more information you can do A- e for all the processes and EF for a full listing and let's pipe this to less then you can see the information that it's displaying the user or uid that the process is running as the P ID the process ID the pp ID which is the parent process ID and you have some more information about what time it's started And command name if you want to get a full process listing of a specific
user you can use this command we'll use me or we could use say the root user let's look at this output in a tree format that's another way to do that here's an example of the PS3 command let's look at the top command and it places the processes that are using the most CPU resources at the top of the list and type a question mark For help I'll type Q to exit here can also look at this program called htop it gives you the same information as taught but just in a slightly different format up
until this point all the commands you have been executing have been running in the foreground when a command process or program is running in the foreground the Shell prompt will not be displayed until that process exits for long running programs it can be convenient to send them to the background processes that are backgrounded still execute and perform their task however they do not block you from entering further commands at the Shell prompt to start a process in the background place an Amper sand at the end of the command to kill the current foreground process hold
down the control key and Press the letter c to suspend the process type contrl Z that will stop the process a process that is suspended is not running in the background it is actually stopped to send a suspended process to the background use the BG command you can background a specific job number by proceeding it with a percent sign for example percent three if you don't Supply a job number BG will Operate on the current job the current job is considered to be the last job that was stopped while it was in the foreground or
the last job that was started in the background to foreground a background process type FG like BG FG will operate on the current job unless you give it a specific job number to kill a job type the word kill space percent and the job number kill requires that you give a job number or a process ID number to list your jobs type The jobs command there are two ways to kill a running process if the process is running in the foreground simply type contrl c to kill it the other way to kill a process is
with the kill command you can run Kill by just supplying the PID or the process ID you can also specify a signal to send to the process the default signal used by kill is termination you'll see this signal referred to as Sig term or term for Short signals have numbers that correspond to their names the default term signal is number 15 so running kill 2 3 is the same as running kill space- 15 space one23 or kill space- term space one23 if a process does not terminate when you send it the term signal use the
kill signal which is number nine let's start a program in the background to do that we'll end the command line with an Amper sand so when a command is run in the Background two numbers are displayed the number in Brackets is the job number and that can be referenced by proceeding it with a percent sign the second number is the PID so if we run ps- P we'll give it the pit of 2373 we'll see that long running process command if you type jobs you'll see that one is the job number for number one you
can also reference it by percent one we'll run the foreground command to bring this job to the Foreground and to kill a foreground process we can type contrl c and that has stopped our process so let's start multiple jobs in the background type the jobs command here the plus sign in the jobs output represents the current job while the minus sign represents the previous job the current job is considered to be the last job that was stopped while it was in the foreground or the last job Started in the background if no information is supplied
to the FG or BG commands then the current job is operated upon the current job can be explicitly referred to by percent percent or percent plus the previous job can be referred to by percent dash for instance we can run jobs that one this way or to look at the previous job we could run this command to bring a job back to the Foreground we can type FG and a job number let's bring job number two to the foreground and then from here we can say kill it and and we'll just hit the we'll see
if that works and then yes now we have jobs number one three and four let's bring job number one to the foreground and we can suspend it by typing control z type our jobs output and we can see one is stopped it's not in the Background it is actually stopped it's not doing any work if we want to send it to the background type BG and then % one now jobs 1 three and four are running in the background let's kill a job by job number let's kill job one and then you'll notice that it's
terminated let's just foreground um job number three and again you don't have to supply FG you can just simply use the job number let's take a look at the kill command real quick let's do a k-l to list all the signals that we can send a process again kill defaults to Signal 15 which is Sig term and in a hard to kill process you would want to use kill -9 or kill-kill for our process let's start couple of jobs here um let's use kill 2394 cuz that's the PID see what happens yep that terminated Our
job we can also use let's do a kill d94 2396 and sure enough that killed that job as well to display information about running processes and programs use the PS command to see all the processes running on a system with a full listing use PS space- EF to look at a process for a given user use ps- followed by the account name to kill a process that's in the foreground type contrl C to suspend a Foreground process typ contrl Z to background that process type BG and to foreground a process use the FG command to
display information about your running jobs use the jobs command you can use the kill command to kill jobs by job number with the percent sign or you can kill programs and processes by pid this lesson covers the cron service the cron tab or cron table format as well as the cron tab Command if you need to repeat a task on a schedule you can use the cron service the cron service is a time-based job scheduling system that starts when the system boots every minute the cron service checks to see if there are any scheduled jobs
to run and if so it runs them cron jobs are often use to automate a process or perform routine maintenance you can schedule KRON jobs by using the cron tab command a cron tab or Kon table is a Configuration file that specifies when commands are to be executed by Kon each line in a cron tab represents a job and contains two pieces of information one when to run and two what to run the time specification consists of five Fields they are minutes hour day of the month month and day of the week after the time
specification you provide the command to be executed this example Chron tab entry runs every Monday at 7 A.m. the command will only be executed when all of the time specification Fields match the current date and time you can specify that a command be run only once but this is not the typical use case for Kon typically one or more of the time specification Fields will contain an asterisk or a star which matches any time or date for that field this job will run only when the minute is zero the hour is seven and the day
of the week is one in the day of the Week field zero represents Sunday one is Monday Etc this job will run on any day of the month and during any month since the asterisk was used for those two Fields if any output is generated by the command in a Chron job it is mailed to you you can check your local mail with the mail command if you would prefer not to get email you can direct the output of the command as in this example you can provide multiple values for each of the fields if
you would like To run a command every half hour you could use 0 comma 30 in the minute field or Star SL2 you can even use ranges with a dash if you want to run a job every minute for the first 5 minutes of the hour you can use 0-4 in the minutes field that job will get executed at the top of the hour zero minutes then 1 minute 2 minute 3 minute and at the fourth minute running a total of five times every hour there are several implementations Of the KRON scheduler and some of
those implementations allow you to use shortcuts and keywords in your cron tabs I'm going to cover some common shortcuts but these may or may not work on your Linux distribution the best thing to do is to man cron and check to see if these will work for you the at yearly shortcut means to run once a year at midnight on the morning of January 1st annually is just the exact same thing as yearly monthly means run once a month at Midnight on the morning of the first day of the month weekly run once a week
at midnight on the morning of Sunday daily run every day at midnight Midnight is the same thing as daily and hourly means to run once an hour at the beginning of the hour or at the top of the hour the cron tab command manipulates KRON jobs you can use Chron tab space file to install the new cron tab from the contents of that file to list your jobs run Chron t-l to edit them use Chron t-e note that Chron t-e will invoke the editor that's specified in the editor environment variable cron tab removes all of
your KRON jobs if we run the cron tab DL command it should list our cron jobs and in this case I do not have any Cron job scheduled so let's create one I'm just going to edit a file with my favorite editor VI any line that begins with an octo Thorp or pound sign or hash or whatever you want to call that is a comment this will be ignored in Shell scripts it will be ignored by Kon Etc let's create a Time specification so 0 minutes 7 for the hour and one represents Monday and we
will put the command we want to run op sales bin weekly report I'll save that to that file now we can install that file by running cron Tab and the file Name now when we list our KRON jobs we'll see that we have one Cron job see let's look at the editor environment variable it's not set let's set editor to VI edit the Chon tab by running Chron tab d e and if I want to disable this Cron job for instance I could just comment it out another way I can do that is run KRON
tabr to delete my KRON jobs and you can see that that remove Them the KRON service run scheduled jobs you can manipulate those jobs with a KRON tab command this lesson will cover how to switch to other accounts and how to run commands and programs as other users one way to start a session as another user on the system is to use the Su command if no arguments are supplied to Su it assumes that you are trying to become the super user or root account executing Su without any options is the Same thing as executing
Su space root your current environment is passed to the new shell unless you specify a hyphen or a dash in that case Su creates an environment like you would expect to see had you logged in as that user use the- C option to Su to specify command to be executed if the command you want to execute is more than one word in length then you need to surround it with quotes if you want to know what user you Are working as run the who am I command if you run who am I it should return
your current account name and after you Su or switch to another user who am I should return that user account's name let's set an environment variable to test with we'll set test a one now let's use the Su command to switch to the Oracle user for instance and you can see that that environment variable is passed on our environment exists after we change to The Oracle user let's use Su with a dash to get Oracle environment and you can see that our environment variable of test was not passed on when we Su space Dash to
the Oracle user also we ended up in the Oracle home directory let's pass a command let's do this Echo Oracle home and nothing was returned we didn't specify that we wanted oracle's Environment rather we used our environment let's use a dash to say let's get Oracle environment and now you can see that that environment variable that exists in the Oracle account is accessible to us another way to switch users or execute commands as others is to use the sudu command sudu allows you to run programs with the security privileges of another user like Su if
no username is specified it assumes that you are trying To run commands as the super user this is why sudu is referred to as super user do it is commonly used to install start and stop applications that require root privileges one of the advantages of using sudu over the Su command is that you don't need to know the password of the other user this can eliminate some issues that arise from using shared passwords in generic accounts when you execute the pseudo command you are prompted for your password if the pseudo Configuration permits access that command
is executed the pseudo configuration is typically controlled by the system administrator and requires root access to change of course on your personal system you have access to the root account and you are effectively the system administrator as well to see the commands that are available for you to run with sudu use sudu sp-l to run a command as a root user just run Sudo space the command you want to execute you can specify a user with- U so sudu space- space root space command is the exact same thing as sudu space command however if you
want to run a command as another user you need to specify that with dasu so sudu space- Oracle space command for example you can use sudu space Su to switch to the super user account if you use sudu space Su space- and hit enter you get switched to the super user Account with roots environment sudu space Su space- space a username would switch to that usernames account with an environment like you would expect to see had you logged in as that user another way to switch to another account with sudu is to use the- S
option if you run sudu space- s that will start a shell as root you can specify a user with a-ash u option we can use the sudu DL command to See what commands we can run with sudu in this case it looks like it can run any command and I don't even need to specify a password here's an example where you would use sudu to execute a command is root for instance let's start an application called Oracle you can also run sudu with dasu to run programs as other users besides root so let's run something
as the user Bob and let's say we need to stop start Bob's App as the user Bob and that worked and that program is running as Bob let's switch to the Oracle account and you can see that I'm the Oracle user and now I'm back to my normal Json account and I can also use studio with a-h s let's do that to change to the root account and you can see that I'm a root account and I'm in my home directory Let's do this another way you can also switch to the root account with sudu
Su or even sudu su- to get Roots environment if you need to modify the sudu configuration use the command viu it effectively starts the vi editor and edits the Etsy sudoers file the viudo command has to be executed with the root privileges this means that you either need to switch to the rout count and run VI sudu for example Su space Rout then run VI sudu or run sudu VI sudu as your own account the sudoers file contains a list of users and what commands that those users can run and as what users those commands
can be run as there are many options to the sudoers file but the most simple format and one that you'll see quite often is a line that gives a specific user a set of commands that he or she can run the specification starts with the user that Is getting the Pudu privilege followed by the host on which that user can execute those privileges on this allows system administrators to use one sudoers configuration file and distribute that to multiple servers the user listed in parentheses is the user that the commands will run as finally a list
of commands is provided that the user can run you can separate multiple commands with a comma also if you don't require that a Password be entered when using sudu you can supply the no password decorator in front of the commands use the Su command to switch users to get the users environment that you're switching to remember to use a hyphen or Dash The Who Ami command displays your current account name the Pudu command allows you to execute programs as other users to switch users with Pudu use sudu space- s or sudu Su if you need
to change the Pudu Configuration use the viudo command to edit the puders file in this lesson we will be covering the shell history how to repeat commands or portions of commands with the exclamation mark syntax and how to use autoc completion each command you enter into the shell is recorded in your shell history having access to your shell history is extremely useful you can search through your shell history repeat commands that you've previously entered And even recall previous commands and change them slightly before executing them again not only can this save you time and keystrokes
but it can prevent you from making mistakes by running a previously known good command some shells like bash keep their history and memory and only write the history to a file on exit common history files include bash history history and his file these history files are stored in your home Directory the history command displays the commands in your shell history it precedes each one of the commands with a number that can be used to reference that command at a later time by default bash retains 500 commands in your shell history this is controlled by the
hist size environment variable if you want to increase this number add export his size equals some number and place that in your personal initialization files you can use the exclamation mark History expansion syntax to rerun a command by number run the history command to get a list of commands that are preceded by a number if you want to rerun command number three in your history you would type exclamation mark 3 enter sometimes the exclamation mark is abbreviated or called bang so if I were to say Bang three know that that means the exact same thing
as exclamation mark 3 if you want to repeat the previous Command you can use Bang Bang enter if you want to repeat a command that starts with a certain letter or string you can enter bang followed by that string for example let's say you want to repeat the cat command you executed a few moments earlier you can simply enter bang C enter in addition to executing entire commands in your history you can pull out parts of a command line the syntax is bang colon number the bang represents an event you Can use the bang syntax
we just talked about bang number or bang string or bang bang when pulling out words from a previous command you can abbreviate bang bang to just bang the number in this syntax represents a word on the command line zero represents the first word on the command line which is always going to be a command one represents the second word on the command line an easy way to think about this is that it represents the first argument to the Command let's say you execute this command head files. text sorted files. text notes. text to repeat that
entire command type bang bang enter if you want to pull out the second argument to the previous command use bang colon 2 VI bang colon 2 is equivalent to VI sorted files. text in this example bang colon 0 is equivalent to head bangon 1 is files. text bangon 2 is sorted files. text and bang colon 3 is notes. Text here are two more exclamation mark syntax shortcuts the first is bang carrot bang carrot represents the first argument to a command it's the same as bang colon one the next shortcut is bang dollar which represents the
last word on a command line in this example command line bang Carro equals files. text and bang dollar represents notes. text if you wanted to edit notes. text you could count the number of words on the command line and use VI bang colon 3 or save the Counting and a character and simply type VI bang dollar you can search for commands in your history to start a reverse shell history search type controlr your prompt changes to reflect that you are performing a search start typing in characters from the previous command that you are searching for
if the first result returned is not what you're looking for typ controlr again to get the next previous match to execute The command as it is simply press the entner key if you want to modify the command before executing it use the left to right arrow keys to start navigating the command line make your change and type enter to execute the command to cancel your search and return to the prompt typ contrl G another way to increase your efficiency at the command line is by using tab completion after you start typing a command you can
hit the Tab Key to invoke tab completion tab Attempts to automatically complete partially type commands if there are multiple commands that begin with the same string that precedes tab those commands will be displayed you may need to hit the tab key twice in order to reveal the possible completion options you can continue to type and press tab again when there is only one possibility remaining pressing the Tab Key will complete the command tab completion not only works on commands but it also works On files and directories you can even use tab completion for environment variables
or usernames when using the Tilda expansion syntax once you spent some time experimenting with tab of completion it will become second nature the history command displays a list of commands in your shell history perceived by a number to run commands with a number you can type bang and the number so bang one will run the first command In our history which is history let's run another command here hist size to rerun the previous command we can use the bang bang syntax and that displays the command that's going to be executed then it executes that command
and then it Returns the output from that command let's repeat the history command this time let's use the bang and a string syntax so we can use bang H for The most previous command that started with h if we want to run the echo command we could use bang two since it's number two in our history list and then again it displays what it's going to run runs it and then provides the output let's look at this LS command again to run the previous command over again bang bang if we want to pull out portions
of that command we can use the bang colon and a number Syntax so let's type Echo bang colon 2 to grab the second argument of this command so LS is zero files is one sorted files is two and notes is three so Echo bang colon 2 should return Echo sorted files. text and then it prints the command that it's going to run and then the output of that command so if again if we want to run a command um that starts with a particular letter we could do that again with bang L so let's pull
that up so we've run our LS command again so if we want to just pull out the last thing on the previous command line we can use bang dollar so Echo notes. text let's pull up our LS command again if we want to run the first argument to the previous command uh we can use Echo bang carrot and that pulls out files. text since it's out since it was the first argument on this command Line let's run some more commands here EO alphab bravo charlie this will grab out the uh first argument to the previous
command which will be Alpha and then we can use the bang syntax to specify an event let's specify the command that began with L so this should be our LS line and let's pull out two sorted files from it and then let's just put in some more text here Delta and then we'll pull out the ls command Again and then the zero word or the command itself from that event so you can see we have Echo Alpha Soder files. text Delta LS if we want to perform a reverse search we can type controll R and
then you see that the prompt changes to say that you're performing a reverse search I'm just going to search for Echo so I'll start typing in E and C so it pulls up the previous command the previous Echo command if That's not the one we're looking for we can type controlr again and we can get the next previous command and then control R again and then if we find the command we want we can just hit enter to execute that command let's do the same thing again h control R to go to a different command
and if we want to modify this command before we execute it let's just press an arrow key and then edit the command line so let's take Off these items and then press enter if you're doing a reverse search and you decide that you really don't want to do that you can cancel it with contrl G and that brings you back to your prompt and nothing has been executed let's look at how tab completion Works let's type the word who and then hit tab tab so there are two possible expansions here if I type the letter
a and hit tab there's only one option and it completes that Command and hit enter and it runs that command let's do the same thing with file so let's type LS file hit tab a couple of times and it shows our choices here so let's do files. text um let's show how this can be pretty quick so if I type LS sorted files. text notes. text and hit enter that's that's fairly fast typing but if you use tab completion it could be a lot quicker so I just typed LS Space s o Tab and then
in Tab and it did the file completion for us you can also use tab completion for environment variables so we know the hist environment variable or the his size environment variable controls how many commands are stored in our history so let's just look at this his and tab and then you can see that there are those are our few options that Are in our environment so I'll just hit s and then press Tab and it completes it you also can do the tab completion with usernames with the Tilda expansion syntax so Tilda represents your home
directory if you don't give it an argument so that's home Jason um if we type in Tilda ADM and hit tab a couple of times we can see that there are two users that begin with ADM on our system so let's just type in I because we want to see the admin users home directory Hit tab it autocompletes and we'll press enter and then that displays /home admin user in this lesson we talked about how shell history is stored and how the number of commands it saves can be manipulated by the hist size environment variable
the exclamation mark syntax though a little complicated is very powerful you can use it to repeat entire commands from your shell history or extract portions of previous commands using the Tab Key to perform Autoc completion can increase your efficiency speed up your workflow and prevent typing mistakes in this lesson we will be covering packages package managers and how to find install and remove software for the most popular Linux distributions typically when you install software in a Linux system system you do so with a package a package is just a collection of files that make up
an application additionally a package Contains data about the application as well as any steps required to successfully install and remove that application the data or metadata that is contained within a package can include such information as the description of the application the version and a list of dependencies or other packages that this particular application needs in order to function a package manager is used to install upgrade and remove packages the package Manager uses a packages metadata to automatically install any required dependencies package managers keep track of what files belong to what packages what packages are
installed and what versions of those packages are installed here is a list of distributions that are based on the RPM package format RPM stands for Red Hat package manager obviously the red hat distribution uses RPMs as well as Centos Fedora Oracle Linux and scientific Linux the Yum command line utility is a package Management program for those Linux distributions that use RPM packages you can find packages to install with yum search and provide that a search string you can also display information about a package or an application by using yum info and the package name you
can install packages with the Yum install package command yum will typically ask you to review your request and say yes or no if you want to Continue to automatically answer yes to Yum's question use dasy also note that installing or removing software requires root or super user privileges to remove a package it's simply yum remove and the name of the package in addition to the Yum command you can also use the RPM command to interact with the package manager rpm-gpg-key [Music] H and the package file to erase or uninstall the package use RPM d e
with a package name let's look for an application to install let's look for something called inkscape so we'll do a search then we see three items returned let's do yum info on each one of those and see what they do inkscape D dos that says it's a tutorial and examples for inkscape that's not what we're looking for let's look at the next one Which was inkscape and that says it's a graphics editor so that is the package that we want so in order to install or remove software we need root privileges we can use sudu
if that's configured or we can also just switch to the root user we'll switch to root and use admin user as the password for this server then we'll do yum install ink Escape says is it okay to download this yes it is I'll Y and Enter all right it says installed our package there there you can also use yum install with a dashy so you don't have to answer why uh to the question here we'll do this with another piece of software called and you can see that this has several dependencies so it not only
installs the application but it installs the other packages that are required for to run properly okay let's look in our applications list Or graphics and you can see that inkscape and has been installed on our system let's remove some software with yum remove we'll do this to and then like install you could use dashy to answer yes automatically I'll just do it manually here and it says it erased that package let's look applications graphics and is no longer showing up in our menu let's say there's some software that you want to install that's not Included
in the package manager let's look for a Dropbox so you can't use yam to install Dropbox or at least directly so will go to dropbox.com download the RPM that's saved in this directory here so we can install an RPM with dasi for install V is ver Bose and H says print some hash marks to show our progress so we'll just do that here and we'll answer Okay Dropbox was successfully installed so can see there it is Dropbox we installed Dropbox you can also use RPM to do some queries so we'll use RPM dqa to query
all packages or to list all packages that are installed on the system and then when we do this we can see that there are no particular order we'll sort the list so it makes it easier for us to read we'll sort it and pipe it to a pager so we can look at at One page at a time and there we go yeah all the way to the end you can see yum zib Etc so you can also ask RPM what file a package belongs to so the program which lives at user bin which we'll
ask RPM what package does that belong to and it's the Wich package you can also say show me all the files or list all the files that are in that package we'll just give it the package name and you Can see that user Bend witch in addition to these other files are contained in that particular package another popular package format is the Debian package format in addition to Debian distributions like lenux mint and a buntu used Deb packages the Debian based distributions use a package manager called apt the advanced packaging tool apt is comprised of
a few small utilities with the two most commonly used ones being apt cache And apt get to search for packages use apt cash search and the search string to install the package use apt get install and the package name you can use dasy to automatically answer yes to any of app get's questions to remove a package use appt get remove if there are any configuration files or configuration changes those will stay on your system with apptg remove however if you want to get rid of the configuration in addition To the package you can use appg
Purge package to show information about a particular package use apt cache show and the package name in addition to the app utilities you can use the dpkg command to interact with the package manager D package DL lists the installed packages D package space- capital S and a path to a file will display the package that the file belongs to D packag with A- capital L will list all the files in a package and To install a package use dpkg space- I and the Deb file here we are on an auntu system let's use app to
look for and install some software we'll look for inkscape and the first result return there looks like what we want let's take a look at it with app cash show give some information about the package its dependency uh it's Description so we will install that with apt get install and installing and removing software requires root privileges you can get root privileges by using the sudu command that's one way you could also switch to the root account do I want to continue yes we'll install this software okay now the software installation is done we can see
if we can find It and sure enough we can see that it's installed you can also just answer yes to apps question with a-y so we'll go ahead and install this way okay is installed and we can see there it is so we will go ahead and just remove it we'll do app get remove again we need root privileges to add or remove software and is now gone from the system let's look at the installing Software from a Deb file I'm on buntu here let's download the Deb for auntu we use D package dasi to
do the installation and Dropbox is installed we can use D package dasl to list all the installed packages let's see let's use D page- capital S and see which file uh which package the which man Belongs to it belongs to the Debian utils package so we can look at all the files in the Debian utils package with the- capital L command let's yeah you can see the very bottom user bin which packages are used to install software on Linux systems you can manipulate packages with a package manager two of the most popular package formats are
RPM and Debian for RPM based Distributions use the Yum and RPM commands to manage packages for Debian based distributions use apt and D package to manage packages congratulations on making it to the end of the course we've covered a lot of topics along the way first you started out by learning what Linux is how it came came to be and some of its strengths and weaknesses then you learned how to gain access to a Linux system so you could practice your skills You got an introduction to the command line interface and started using some basic
commands next you learn how to manipulate files and directories you also learned how to use the Nano VI and emac editors you conquered obscure Linux permissions and learned about IO redirection and pipes along the way you learned about how to customize your environment and picked up some tips at becoming efficient at the command line at this Point you not only know the fundamentals of the Linux operating system but you can also use your knowledge to accomplish worthwhile tasks please let me know how this course has helped you and if there's anything I can do for
you I hope to see you again in another one of my courses thanks the purpose of this lecture is to answer some questions about connecting to a l system over a network specifically this lesson will cover Connecting to a virtual machine over a network if you're using a virtual machine where you are connecting directly to it or you have physical access to a Linux system or you were able to connect to your Linux system over the network successfully feel free to skip this lesson in this lesson you'll learn all the steps involved in connecting to
a virtual machine that is running Linux over the network we'll talk about the Settings needed in virtual box to allow for network connections you'll also learn how to check if the Linux system is ready to accept network connections and if not how to prepare it for those network connections if you're trying to access a virtual machine that is running on your system the easiest way is to Simply start up the virtual machine and interact with it through virtual box for this course there really is no need to connect to the virtual machine over the Network
I really recommend just typing into the virtual machine directly for this course here's an example I've went ahead and started virtual box on my local machine or my host system and I have a virtual box that is running I'm simply going to open this virtual box and you can see that it's in a window in a virtual box window you can see the the uh menu options from virtual box itself so what I'm going to do is simply click Into this virtual machine and then interact with it as if it were a real physical iCal
Linux machine that I'm sitting in front of you know I can do things like start a terminal or start a web browser and I can you know just type right into this system and that's really how I recommend you go through this course but again this lesson is for those of you that want to connect to a virtual machine like this over the network if you are one of those people That want to connect to the virtual machine that is running on your computer you need to do a couple of things that you may or
may not have been introduced to at this point unless you have a compelling reason to do so I would suggest waiting until you finish the other lessons in this course before continuing with this lesson the first thing you need to check is the network configuration of the virtual machine and virtual box make Sure that the virtual machine is stopped otherwise you will not be able to change the configuration if you need to do so I'm going to highlight the virtual machine and click on settings so here's the machine that I'm virtual machine that I'm working
with and I can click on settings up here or I can even rightclick and click settings here what we want to do is make sure that the network adapter is set to bridge I'll go here and click on network And we can see that it says it's set to Gat it's attached to natat so I'm just going to select bridged adapter you can make this work with Nat in conjunction with port forwarding but it's just simpler to use Bridge networking in most cases especially if you're working on a typical home network bridge networking allows the
virtual machine to exist on the network just like any other machine it makes it most act like actual Hardware so now that you have Bridge Network configured you can go ahead and start the virtual machine I'll click okay to save my changes and then rightclick and start unless Auto login is configured you'll have to enter a username and password to get access to the Linux system so to connect to a Linux system over the network you need to make sure that an SSH server is installed and running and we can check that by looking at
the process table let's go ahead and Open a terminal and we can look at the process table by using the PS command in this example I'm going to use ps- EF I'm going to pipe that to grip and I'm looking for sshd which is the SSH Damon or the SSH server process so in this case no sshd process is running we just see the grip command that we just ran but no sshd process let's check to see if it's even installed this is a buntu system so I'm going to use the dpkg Command to look
for an SSH server I'm going to use Dash shell to list the installed packages and I'm going to for S sh- server If This Were a red hat based system I would run RPM dqa to query the packages that are installed and list them all and then grab for SSH DS server um since this is not a red hat based system RPM isn't installed but at any rate uh when we looked when we listed the packages we had no uh SSH server Packages returned so that means SSH is not installed on an abunto system what
I need to do first is run sudu apt get update after I've done the appt get update I'm going to run sudu app get install open s-s server and open s-c uh I'll make sure that the SSH client is installed so I can connect to other systems from this system if I need or want to I'll go ahead and answer yes to any Of these questions here and in just a second you'll see that it gets installed if I were on a red hat base system like red hat or Centos or Fedora I would use
sudu yum and install open s-s server and op s- clients remember that the important thing here is that you install software with root privileges so if sudu isn't configured you would need to Su to the root user and then run the appg or yum commands so Now let's look at the process table and check for sshd okay now that we can see that sshd is in fact running if it wasn't running I would start it with sudu service SSH start um that's for an auntu system on red hat it's slightly different it's SSD start but
in our case it's running so I don't need to do this so now that sshd is installed and running we need to know the IP address of this virtual Machine to get that information we can run the spin IP space addr command in this example there are two Network interfaces you can see one colon and then some information and then a line that starts with two colon and that is the second network interface the first network interface is a virtual network interface that will be present on all systems it's called the loopback device it allows
the system to communicate with itself also it always Has the IP address of 127.0.0.1 the other network interface is the one that we want to pay attention to so we'll look at the inet line here and what appears before the forward slash is the IP address on my system it's 10.0.0 6 on your system it's probably going to be something else finally let's go ahead and confirm our username with a who am I command and in this case it's admin user Many times SSH access is disabled for the root user for security reasons so you'll
have to connect to the system with a different user so if you try to connect to a system as root and it doesn't work this is probably why you'll also need to know the password for the account and this case on my system with the image I'm using the username is admin user and the password is admin user as well again this username and password will vary From system to System of course my physical computer or my host computer is also running Linux in your case it will probably be windows user Mac I'm going to
open up a terminal and attempt to connect to the Linux system that is running in Virtual box if you're on a Mac this is the exact same process let me go ahead and open up my terminal I'm going to run the SSH command I'm going to run SSH and then provide the username uh on the remote System so on my local system my username is Jason but that's not what is on the remote system so I have to supply it explicitly so I'm going to type an admin user use the at symbol and then I'm
going to take the IP address that we got from the IP addr Command so in this example it's 10.0.0 6 and of course on your system it will probably be something different promps me to verify the key I'm going to say yes and then I need to Enter the admin users password and I hit enter and here I am I'm logged into the virtual machine I'm going to go ahead and just exit out of the virtual machine and I'm going to demonstrate the use of Putty for the uh people connecting with putty on Windows machines
I'm just going to uh start putty here I have putty installed on my Linux system to connect via putty I'll just click in the host name section here and enter the IP address of our virtual Machine and this example it's 10.0.0 do6 and I'll go ahead and click open here you can see that putty is asking you to confirm the host key and we'll go ahead and click accept and now we need to type in our username which is admin user for my system and then the password and then so now you can see that
we've successfully logged into this virtual machine over the network using putty in this lesson you learned how to Connect to a Linux virtual machine over the network you learn that first you need to set the network adapter settings to bridged networking mode you also learned how to make sure that an SSH server is installed and running next you are able to get the IP address of the Linux system by using the IP space addr command keep in mind that you may need to log into the system using an account other than the root account finally
you use the desired account and IP address To connect to the system over the network using a command line utility such as SSH on a Mac or Linux system system or using putty on a Windows [Music] system this video demonstrates how to install WordPress on auntu to get started we'll download WordPress go to wordpress.org and click download and we'll save that file we'll use that in a Minute next we're going to start the terminal application and we're going to use this to install the lamp stack now lamp stands for Linux Apache MySQL and PHP we've
got a buntu so we've got the Linux part next we need Apache MySQL and PHP so as a general guide we can use apt cache and search and let's just search for Apache and you can see several items come up I'll just pipe this to less and As we can see at the top here Apache 2 uh is the Apache HTTP server so that's the pie piece of software that we want to install let's see what the package is for my SQL server and we see my SQL Das server okay and php5 and also I
know WordPress requires the GD module so we'll install that now we install software with app get install and this Requires root privileges so we'll use the Pudu command to give us those root privileges we can install each piece of software one by one for instance we can install Apache with Apache 2 and hit enter or we could install multiple pieces of software by supplying those on the command line and we'll do that here php5 ph5 [Music] GD and then we'll say yes to download the Software we'll let that download and install and we'll give the
root user of password okay our software has been installed let's create a database for WordPress to use we'll use the account in my SQL with the password that we created on installation and let's create a database create database um let's just call it WordPress let's create a User and let's Grant privileges to that database now let's flush the Privileges okay that should do it let's go to the downloads directory where we downloaded WordPress and let's extract the contents of that file and we'll change into this directory and let's copy WP config sample to WP config.php
and let's edit that file exclamation dollar sign says take the last item on The previous command line and substitute it so we're going to edit wp-config.php and our database name is [Music] WordPress um the user we used was also WordPress and the password I do believe was w ppas and that should be all we need to configure here if you're not familiar with the vi editor that's okay you could use something like Nano it's easier to use a much simpler Interface I'll just hit exit there next let's look where HTML files live and that's right
here we don't need this file we'll get rid of it and since it's own by root I'm going to need root privileges that's why I'm using sugu here let's see need to copy all those contents actually an easier way to do this is just remove this directory and Move WordPress to here and then I'll just rename WordPress to HTML and then this user is the user that runs the Apache process so I'm just going to change the ownership of this directory to that user actually let's do a recursive change here now you can see that
the data is owned by dubdub du- dat next let's switch back to our web browser and perform the Installation since this is running on Local Host we'll just use Local Host as the address here looks like we need to install one more piece of software and we'll use install PHP 5 MySQL let's see if that does it for us let's restart Apache for good measure here and let's go back and try again okay I'm not going to use my real Address I'll just use uh local host. local domain and send any email to the uh
bunto server that we're working on here okay click log in and there you have it WordPress is installed [Music] in today's lesson we're going to talk about what a terminal emulator is and a few different methods on how to gain access to a Linux system if you already Have access to a Linux system feel free to skip ahead a terminal is a hardware device that allows you to enter data into a computer and for that computer to display data back to you in the past terminals were typically connected to computers or servers via a cable
of some sort typically a Serial cable terminals themselves actually look like computers they have a keyboard for entering in data a display to display the data back the big Difference between a terminal and a computer is that a terminal is worthless unless it's connected to a real computer or a server this is why you'll sometimes hear terminals referred to as dumb terminals today terminals are obsolete we still need to enter data into a computer and allow a computer to display data back to us but the technology has changed instead of using a terminal to connect
to a Linux server what we do today is use a terminal emulator Application that acts as if it were the terminal you can use a terminal emulator application to communicate with your local computer for instance if you are running Linux as your primary desktop and you are using a graphical user interface you could start up a terminal emulator application in order to interact with a command line of Linux if you're using Windows as your primary desktop you could start a terminal emulator application and connect to a Linux server over the network in order to practice
the skills you'll be gaining in this course you're going to need access to a Linux system one quick and easy way to do that is to open up a web browser and visit simples shell.com simples shell.com allows you to connect to a Linux server you just click Start my session and a terminal emulator opens up each session is is limited to 15 minutes so if you just want to spend just a couple of minutes drawing out a New command that you're learning about this would be a great way to practice that a couple of alternatives
to simple shell include web Manu like terminal except for web webm n.org and Linux zoo. net if you have your own website you very well may have access to a Linux account um many times shared hosting providers use Linux as the operating system which runs their web servers look at your web hosting company's documentation and look for the Words shell access or SSH ssh stands for secure shell and SSH is a network protocol it allows you to take your terminal emulator application and connect it over the network to a Linux server shared web hosting is
typically inexpensive it's usually only a few dollars a month some of the same companies that provide web hosting Services also provide virtual private servers sometimes called VPS for short these virtual private servers run Complete operating systems and they're not shared so only you have an account for this entire operating system and you can do anything with this virtual server that you could a real physical server again since it's not shared and you have full control over the server you can reboot it at will this is not such a good thing if you're in a shared
hosting environment that's why uh your accounts in those environments have limited access if you like the idea of having Full control over a virtual server you could look into cloud computing as well in Cloud a virtual server is called an instance you'll hear people talking about spinning up an instance that simply means they've deployed a virtual server running a complete operating system one of the main differences between Cloud providers and traditional web hosting providers that provide shared hosting and virtual private servers is that cloud Cloud servers or Cloud instances can be programmatically deployed that means
you can create software that starts Cloud instances or stops Cloud instances in our case we just want access to a Linux server so you don't have to take advantage of those features if you don't want them just know that VPS virtual private server or a cloud server or Cloud instance are all the same thing another way to get access to a Linux server is to run a live Linux Distribution a live Linux drro typically runs from CD or USB key or a DVD ROM you insert the bootable media start your hardware and in just a
few minutes you are placed into a live running Linux operating system the reason why they're called live Linux distributions is they do not write to your hard drive they are not installed on your computer they're just live so they run as long as the power's on the minute you reboot your computer your operating system is gone The advantage of using a live Linux distribution is that you can try something out without modifying your computer the disadvantage of using a live Linux distribution is that when you're using it you don't have access to your primary operating
system for example if you're watching this course on your Windows PC and you wanted to try a few new Linux commands that you've learned about you would have to stop your Windows operating system put in a CD and power up the computer again in order to boot into Linux it's important to keep in mind that live Linux dros shouldn't be used to evaluate performance of Linux when you're running a live drro you're typically running it from a storage device that is a lot slower than your normal hard drive a few live Linux distributions that are
fairly popular include Fedora knopic Puppy Linux and Ubuntu live Linux dros by default do not modify your system in any Way they won't write to your hard drive for instance however most live Linux distributions do include a utility to install the dro to your hard drive if you decide you like it of course you can always install Linux on a computer if you have an extra laptop or an old PC that you're not using anymore then pick a Linux distribution and install it directly on that if you do decide to install Linux yourself don't worry
if there are things in the installation Process that don't make sense or that you don't fully understand typically the defaults are pretty safe just accept the defaults and you should be good to go the last method I'm going to talk about today is using pre-installed Linux images with virtual box this is the method that I recommend you use with this course virtual box is virtualization software it allows you to run entire operating systems within your current operating system your current Operating system is called the host or the host operating system and the virtual machines that
you'll be creating are called guests like Linux virtual box is free and open-source software virtual box runs on Mac windows and even Linux in the next part of the course I will show you how to install virtual box on Windows and also how to install it on Mac from there I will show you how to get the pre-installed Linux images and how to import those into virtual box Then we can get started with the main course content the ways to get access to a Linux system include going to simples shell.com in your web browser using
a hosting provider be that a shared web host a VPS host or a cloud host you can install Linux on hardware and you can also run Linux inside a virtual machine this video is for Windows users only so if you're using a Mac go ahead And Skip ahead to the next video first let's open up a web browser and visit virtualbox.org next find the link that takes you to the download page currently that's downloads we'll click this here from here select the file for your platform which is Windows so we'll click on the link next
to Windows hosts once the download is complete we can click on the file to begin the installation Process the installation is fairly easy we're simply going to accept all the defaults and enter yes to all the questions so here I'm going to go ahead and click on next again I'm going to accept the defaults by clicking on next the defaults are fine click next yes and finally I'll click install again whenever you're prompted go ahead and click on yes at the end of the installation Clicking on finish will start virtual box okay the virtual box
application started so the installation went correctly to start virtual box in the future there's a couple of ways you can do it one you can click into the search bar and simply start typing virtual box then you'll see the option in the search results so Oracle VM virtual box another way you can find it is by clicking on the Windows Button and then navigating to it and in this method you want to make sure you're looking for the full name of the application which is Oracle VM virtual box so here you see an oracle VM
virtual box folder so we'll click in there finally you'll see the application itself Oracle VM virtual box and that's how you would start it in the future next let's install a program called 7zip to do that we'll visit 7-zip.com always click on downloads to go to the full download page here I'm just going to click the download link next to the 64 bit file we'll click that and make sure that that downloads next we'll click on it to start the installation we'll click on yes here again we're going to accept the defaults just like we
did with virtual box now the installation is complete and we can click close in an upcoming video you'll be asked to download and extract The contents of a compressed archive file you'll do that with this 7zip program that we just downloaded here's an example of how to do that I have a file downloaded that ends in 7z I've navigated to that file using the Explorer it's in my downloads directory here now I will rightclick on the file go to the 7zip submenu and then click extract here you'll see that a new folder appears and it
has the compressed Version of the file in it so I'm going to double click in there and now you can see that it has a file there now you're ready to install Linux in a virtual machine using virtual Box open up a web browser and visit virtualbox.org look for the downloads link now click on the installation file for your platform in this case we're downloading the the Mac installation file once the download is complete open The file now double click on Virtual box. PKG that will start the installation process click continue click continue again you're
just going to accept all the default click install at the end of the installation you can start virtual Box by opening up the finder navigating to the applications folder and double clicking on Virtual box this process is outlined in the Supplemental material that is attached to this video the first thing we want to do is download a Linux vdi or a virtual dis image to do that we'll go to virtualbox images.com and in this case I'm looking for Centos I'm going to find that in the rightand column and I'm looking for a desktop there it
is now I'm just going to click the download link and let that Start downloading if you follow the document that's attached to this video you won't have to search around their website in order to download the image I've provided links to the page and the direct download link for you as well while that one is downloading let's look for Ubuntu you don't have to download both images you can just pick one and download it you can look at the Centos Page and see if that appeals to you in any way if it does download that
one if it doesn't try auntu the files that download are actually archives so we'll need some sort of software to extract the contents of those archives for Windows we'll use free when UNR you can open up a web browser and search in Google for f w i n u n r a r we'll pull up the website and then download the installation file to perform the installation open The file and accept the default in this case just click install and then close now you can find the archive that you downloaded right click on it and
click extract and you can see that in this archive there were three files for Mac users we can use un RX download that from un nx.com once it's downloaded double click on the zip archive to extract it and then drag That to your applications folder to extract the contents of the archive just double click on the file that you downloaded and you can see that in this archive there were three files from this point on the process is the same whether you're using Windows or Mac start virtual box click new give your virtual machine and
name either cintos or Ubuntu you can leave the r at the default if you have extra you can add some more choose use an existing virtual hard drive file click the folder and navigate to where you extracted the virtual dis image click create now click on the Green Arrow to to start your virtual machine in this example I'm using Centos you can see that it boots up At the login screen I will use the password that is in the documentation um as of right now that username and password is admin user now that we see
it works I'm just going to close the browser and shut down the OS now you have your very own copy of Linux that you can use with this [Music] course today's video we'll show you how to install virtualization software that Will allow you to install guest operating systems and also how to install a bunto Linux to get started let's go to virtualbox.org and click on downloads this is the virtualization software that we're going to be using and then you select your platform in this case I'm using Windows as my host operating system and so I
would click this link here you can also Install virtual box on Linux on Mac or even Solaris I've already downloaded this so I'm going to just pull it up right now and then double click to run it and I'm just going to accept the defaults click next next again that looks fine going to click install and do the same for all the messages like this in the future Click finish to complete the installation and then we'll we'll restart later so the next piece of software we need to install auntu is auntu itself so we'll go
to abun to.com find the download link and then here we have a couple of different options the primary options are auntu desktop and auntu server the primary difference between desktop and server is that the desktop Edition Provides a graphical user environment whereas the server does not a buntu server is best for things like web servers or database servers or file servers it's going to be an installation of the operating system where you don't sit down in front of it and use graphical programs a buntu desktop on the other hand is for just that so I
will click download a buntu and take the default 64bit I've already done this to save us Some time so I'll just close the web browser here and you can see that I've downloaded a bunch to we'll go ahead and start virtual box and then create a new container or virtual machine for our auntu operating system install station you can see here that it asks for three bits of information the name the type and the version so I'm going to name it auntu desktop and then as I type that in There it automatically selected Linux as
the type and a buntu as the version if it didn't you can simply use the drop- down boxes and select whatever is appropriate the minimum amount of ram recommended is 500 12 megabytes um I have plenty to use here so I'm going to dedicate about half my resources uh to this virtual machine so I'll use 4096 megabytes or 4 gbt next we need to create a virtual hard Drive click on Create and the default of vdi is fine uh especially if you're not going to be using this uh disk image with other virtualization software you
have two choices here one is dynamically allocated and the other is fixed size if your primary concern is about preserving dis space or using as little disc space as possible choose dynamically allocated however if you're looking for performance use fixed Size that's a fine name I will specify 100 GB for my hard drive although 8 GB byes is sufficient to install a buntu 2 I like having some additional space so now we have our virtual machine next we need to install a buntu let's power on the virtual machine to install a buntu we'll click Start
or you can even rightclick and click Start there either one is fine then now it will ask us for the Auntu image that we downloaded I'll select where I downloaded it on my computer and click Start you have two options here one is try a buntu and the second one is install a buntu try auntu simply runs the operating system in memory and let you try it out however install auntu actually writes to your hard disk in this case it's going to write to the virtual hard disk in the virtual machine so we're not going
to lose any data for Example overwrite our current operating system so that's what we're going to do here install I'm going to click continue and accept the defaults here but but you can install thirdparty software that allows you to play MP3s for example and you can also download any patches or bug fixes or other updates for the auntu operating system by clicking download updates while installing I'll click Continue and I'm going to just erase this disc again it's a virtual disc that we just created and then you can click on the map for your time
zone I'm just going to leave it at Chicago and you can choose your keyboard here and just fill out your account information and click continue the installation will take several minutes to complete so I'm just going to fast forward from this point On once the installation completes your job is done if you're running on physical Hardware such as a desktop a laptop or a server however since we're using a virtual machine we need to perform one additional step and that additional step is to install some software that helps Linux understand the virtual Hardware that it's
working with and that piece of software is called guest editions in Virtual box now that the installation is Finished I'm going to power on the virtual machine can highlight it and click Start or right click and click Start going to log in with the password that I use during installation and next since this is a virtual machine we need to insert guest Editions CD image and install the guest editions and then we'll click run and it will ask for our password again so we'll type that in and click Authenticate and we'll let the virtual box
guest editions install okay that's complete we'll just hit return or press enter and then now I'm going to restart this virtual machine so it can uh use the guest editions and I'll click restart going to log in again with my account and there that's so much better the graphics are filling my display and a buntu is installed [Music]