Linux commands for Cloud and Devops engineers

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello and welcome to my youtube channel in this video i am going to teach you about all the important linux commands that every devops or a cloud engineer should know in this video i'm covering all the topics like creating a file directory editing them installing packages from internet and connecting to a remote server all the advanced stuff is going to be cleared so if you want to become a linux expert watch this video till the end and let's get started and learn linux i can see what are the different folders or what are the different directories or files present in my current path so if i do ls and i do enter you can see that i can see all the different folders so let me show you that with an example of while showing this by side as well so you can see that the all these different files are present here so you can see ansible app started and bin desktop everything is present here so when i do ls i can see the different files present in my current directory so let's create a folder so that we can learn so that we can learn about all the different commands so if to create a folder i have to run a command which is make directory which is mk make dir so this means make directory and directory is also known as folder so whenever you heard about directory just consider it it as a folder so let's create a folder named as uh learn linux so you can see right now i don't have any folder which is named as learn linux so if i go here so you cannot see any folder which is learn linux here and if i do enter i a folder which is named as learn linux will be created so let me show you that so if i search for learn so you can see there is a folder which is learn linux it is created right now and it does not have any items in it right so it says zero zero item so let's go inside this learned linux if you go through a graphical interface you just have to click on it but if you want to go through terminal you have to run a command which is cd also stands for change directory so if you want to go in any of the directory let's say for this learn linux i you just have to type in the cd command and the name of the directory so i can just type learn and i can press tab to auto complete so if i do learn and i press tab it will automatically type the linux which is it will do autocomplete and we can get the whole name of the directory and if i do present if i do enter you'll see that there is a change now and now you can see that here you can see there is learn linux which means i am inside my learn linux directory or learn linux folder right yes so this till design that you see here stands for the home directory so in home directory you are inside the learn linux folder now if you want to create a file you can do it with the command which is known as touch touch and the name of the file so let's say i want to create a file which is one dot txt so if you see there is no file currently here and once i run this command there will be a file here so touch is the command to create a file and it will create an empty file so touch one dot txt will create a file and if i do ls i should see a file inside so you can see that one dot txt is present now and if you see here there is one dot txt inside here as well right so touch is a command to create a file which should be empty so if i go here you can see that there is no content present here right but if you have if you if you have like done the previous sessions you know about the command which is nano so nano nano is a text editor which can be used to edit or insert test text inside a file so i can go here and type in nano1.txt and i can start writing anything so like and i can say this is a linux file right so i am inputting some text here and i can save it by doing exit control x and y and now i have some text written in my one dot txt which if i'm using graphical interface i can double click on it and i can see that i have written this is a linux file but how do i read it through my terminal so i can use the command which is known as cat so cat and the name of the file so one if i type in one it will autocomplete and give me the file name and if i run cad 1.txt you can see that it shows me the output which is this is a linux file right so touch is used to create an empty file nano is used to create manage a text editor which can write or edit text right but you can also create a file using nano and you can also let let's say there is no other file like there is only one.txt i want to create a file and i also want to input some text in it so i will do nano nano.2.txt so i am creating a second file and i am also editing it right right now so if i type in enter it will open the text editor and i'm going to type in this is second file right and i save it i press enter and i save it now if i do ls i should see two files right now so i have two files one of them is created using touch and the second one is creating using nano right so if i do cat2.ext i should see the content inside the 2.txt if i press enter now i should see that this is the second file same as what i have entered while creating the file same way if you see here you can see two files created now using using linux you can create a lot of files in just a fraction of seconds so let's say i want to create a lot of files so three dot txt and four dot and 5 dot txt all of them in a single command if i do enter i don't get any error and now if you see i have five files right now right so using linux commands you can create a lot of files you it is very easy for you to work with linux when you use commands and now we have learned how to create a file how to list the files in the directory how to edit a file or how to create a file using nano as well so let's learn how to delete a file so to delete a file you have to run this command which is rm also stands for remove so if i want to remove any of the files let's say i want to remove the one.txt file here i just need to type in the name rm1.txt and if i press enter it will remove the file now if i do ls i should see all the files except one dot txt so you can see that one.txt is gone now but it doesn't give confirmation no no it won't give you confirmation if you if it gets gives you any error so if you if it gives you any error then it is a problem if it does not gives you any output if it does not gives you any error which means your command has run successfully right so now you have learned that how to delete a file so if you want to delete any single file you can just run rm and the name of the file if you want to delete all of the files i have already told you about this mark which stands for asterisk or all the files so if i run this everything inside this folder should be deleted so if i run this command you should you have got no error no output which means your command has run successfully and if i do ls you should see that no files are present now if i show you in the graphical user interface it says that folder is empty right so now you have learned how to create a file how to edit a file how to delete a file and how to build multiple files as well right so let's go ahead and create more files right now so one dot txt two dot txt and three dot txt so this file will create three files at once so if i do ls you can see three files are created right now let's go ahead and create a directory inside this directory and i'm going to create a directory named as test or test let's create a directory inside this learn linux command it learns linux directory and to create a directory the command is mkdir and the name of the directory which is test1 so if i go and type so you can see that test1 is created and the test one is in blue color whereas the all the other files are in green color so this indicates that test one is a directory and all the other files all the others are files but if you want to still see like what are the types so you can do ls hyphen l and this will tell you that this is the directory so if you see here d which is directory and if you don't see anything else which means it is a file and this are the permissions of the file so r stands for read w stands for write and the x that you see here stands for executable so read write execute read write execute and read write execute the first column is for the group and then for the organization and then for the people so i'll be teaching you that later on but for now just remember that we have created a directory which is test one so let's go inside the directory so to go inside directory you have to run cd command or change directory command and the name of the directory which is test one so now i have only press the tab key and it has entered the name of the directory that is test one because that is there is only one test one directory in inside this so if i press enter which means i am inside my test one directory right so this path will tell you where you are right now so now we have learned how to create directory how to create files how to edit how to remove all of the stuff so how if i want to go back to my learn linux command learn linux directory how am i going to go back so to go back to a previous folder you have to run cd as space dot dot this means you are going to go back to the learn linux directory if i press enter you should you will see that i am back inside my learn linux i am no more into my yeah i am one step back right if you want to go go two step back let's go back to the test one directory now and if you want to go to the two step back you can do two dosh and a separator slash and if i press again two dot i will be back again to my home directory this directory here right so if i do here i am back again inside my test home directory so this cd will take you one dot one step back this will take you two step back right and if let's say i'm i want to go back to the test directory again so i'm going to do learn linux so learn linux and test i am inside my directory so if i if i am anywhere no matt no matter anywhere if i just type cd it will take me back to the home directory no matter i am anywhere so if i do cd i am back again to my home directory so this is one of the uh thing you need to know that no matter where you are so let's say i'm inside my app directory and what do i have in there so i have test in that also why do i what do i have in test i don't have anything so i'm inside my app directory i'm inside my test directory so if i do just cd i'm back again to my home directory oh it's like cd spell dot dot slash dot dot exactly yeah same same so let's say let's go back to the learn linux again and let's go back to the test one again so inside let me let me make more directories so if let's say i want to make test 2 and i want to make test 3 and i want to make test 4 and i want to make test 5 so i cannot do it i just want to pass in the uh hyphen r command so let's say i'm going to create only a directory inside a test one directory which is test2 and i need to go into the test to directory so i am inside my test to directory right now so if you want to do this two commands at on a single line you can do like this as well so let's say we are going to create another test three directory and i also want to go into that directory in on a single command so how can i do this i can do it by running two commands separating it using this symbol so mkd directory test three and cd into test three right so you can see now i have also created and i'm also inside my directory right so if i am here i if i want to go back to this home directory i can do it by running cd only or else i can also do it by going back so if i do this i'll be back in test two then if i do this i'll be back in test one then if i do this i'll be back into learn linux command and if i do this i'll be back in my home directory now all right but if you do cd you will go back yeah if i no matter where i am no matter inside wherever i am if i just do cd i'll be back to my home directory right so now i hope you have learned about the cd cd command correctly so let's go back to our learn linux test one command and let's go and delete uh the folders inside it so let's go let's see what do we have here so we have test2 i'm going to go into test two what do i have here i have test three so let's go and see what do i have in test three i have nothing in test three now so i'm going to go back one step back and i'm going to delete this delete this folder here test three so to delete any folder or any directory you have the command remove directory so remove directory and the name of directory which is test three year so i'm going to press enter and i see that there is no test three now let's go back again to my test two and if you see here you can see test two is present but let's say i want to delete the test one and test two at a time so i can go back here and i am inside my learn linux i have test one and inside test one i have test two right so if i want to delete i can run the command test one like i have done previously but it will show me an error it says that directory is not empty so you cannot delete the directories which are not empty so to delete them you can run hyphen r and the name of the directory so if i do ls you can see the test one has gone so this hyphen r stands for recursive and this can be this can be confusing like when to use what and there is another command which every one should know which is man which stands for manual and man and the name of the command so let's say i am running rm this will tell you everything about this command every detail about this command if i run manual rm so i will get the detail like what is the name rm rm is to remove files or directories so you this is the syntax and it gives you the description that this manual page documents is the gnu version rm removes each specified file and it will give you all the other options you have like f is for force i is to prompt every removable hyphen i so if you see iphone r is recursive which removes directories and their contents as well so whenever we use iphone r we have deleted the directory as well as whatever was inside it right so you can also get yes recursive so yes you don't need to remember this you will learn this when you do it practice you when you practice it and so it says like this manual page if you want to get more help you can press edge if you want to quit you can press q so i'm i press q and i'm back inside my inside my terminal again so now you can see that it is quite a mess and if you want to create clear everything out if you want to delete everything out and clear the screen you can run this command clear and you're back again with the fresh screen right so now you have learned how to create directories how to create files how to edit them everything and now i have three files inside my learn linux directory all right so let's create another directory to learn some more commands like copy and move so let's create a file to let's test one so i'm create a directory which is test one so if i do ls i should see all the files and the directory test one so let's say i want to copy this file one dot txt from learn linux and copy it to test one so to copy any files i have to pass in this cp command cp stands for copy name of the file one dot txt and where do i want to copy it i want to copy it in my test one so this slash that you see at the end means it will be inside inside that directory right so if i do enter you should this has shown me no error which means i have copied the file inside text one so let's go back to the graphical user interface so i am here this is the test one i have copied my file from my learn linux to the test one so i should see a file name as one dot txt inside this so if i you can see that there is a file one dot txt right so cp command is used to copy the file and when you copy the file is also present in the original directory as well as there in the directory that you have logged into so if i do here and you can also ls directly from here rather than going into so i can just check what are the present what are the files listed in the test one so i can do ls and i can see that one dot txt is present in test one so this is this is copy command let's say we want to move a comma move a file so to move a file let's say i want to move two dot txt from learnlinux to the test1 directory so i can run mvcommand which stands for move mv2.txt inside the test1 so if i press enter it showed me no error which means my command has run successfully my uh my file has been moved to the test1 directory so if i do ls now you should see that two dot txt is not now is not present right now in the learn linux because it has been moved to the test one directory so if i do ls test one i should see two dot txt present here as well right so this was how to copy or move a file from one directory to another directory so let's say you want to move this file to lay to the home directory or let's go to the home directory and i want to move the two dot txt in my this folder app folder so how can i do this so i can do this by let's say three dot txt i want to move this file to from home you have to you have to paste in the full path like the path is from home to the app so the home directory is also known as this side right we can also call this this is our home directory and what do we have inside our home directory so that we have 112 files so we don't want to do that so let's say i want to pass in the app so which what are the files that starts with a so i can press tab key and i can see that all these files all this directory starts with a so i want to pass this in the app folder here so i can do tab again and this file will be transferred from learn linux directory to the app directory which has which is from home to the app directory so if i press enter it has given me no no errors which means my file has been transferred successfully so let's do ls and see if three is present or not so you can see that three has been gone from here and if i do ls home app i should see that three is should be moved in here so you can see that three has been moved here right so whenever you are working in some other directory which is one step back from here you have to pass in the full path of that directory right because this app is not present in the learn linux directory it's present in the home directory so you have to first move to the home directory and then search for the app directory then paste it or do any command you want right so even if i want to delete the file 3.txt from my learn linux command here i can learn the next directory here i can do it by passing in the full path so let's say i want to delete the rm.txt which is inside this this path here right so i have to fasten full path that is app so app and what files do i have i have three dot txt i have all these different files i just need to delete the three dot ext so i can pass this here and if you do ls so if i press up arrow key and i see the contents of app folder here i can see that three dot txt is gone now right so i hope you have learned all the file commands which is ls which is cd which is rm to remove which is mkdir to create directories which is test command to create files nano command to create files with content and mv command to move cp command to copy as well right so let's clear it out clear is to clear all the things so let me check what do i have here to ls to list all of the things so i have one dot txt so you now know that move command is to move the files yes but there is also one more thing that you can do with move commands which is you can rename the file so let's say i want to rename the one dot txt to my new file my new file.txt so i can also do it without so i can move and rename the files with the same command so if i press enter you can see that there's no output or there's no error given out and if i do ls you can see that my file has been changed from one dot txt to my new file dot txt so this mv file can be used to move also to rename the files so and if you want to get the information about any commands i have already taught you about this manual command which is man and let's say i want to learn about the mv command or the move command so i can press here and you can see that this command is used to move as well as rename the file right so you can go here and learn about the options you want you can check who was the author so this mike parker david mckenzie and jim maring has created this command and you can also learn about it but that's that's of no use you only need to know like how the command actually works so i'm going to press q and i have now learned a lot of commands for the file right yes yes so now we are going to learn how to actually install packages which is very important for every devops and every cloud engineer because in your job role you'll be installing a lot of packages you'll be installing docker you'll be installing git you'll be installing jenkins all the different tools right so okay who will be installing they might ask you to install because there there might be a company which does not have a devops or cloud engineer they only have a single person to perform all the actions so they can ask you to do it and when you are giving interviews they're going to ask you linux knowledge so if you're learning all of the things why not to learn the installing packages as well yeah your ideas yes so to install any packages you have to run a command which is apt install in ubuntu so there are in linux there are different flavors like there is centos there is fedora there is debian there is ubuntu there is red hat all the different flavors in linux right so for ubuntu you have apt and if i do man apt manual apt it will show you that this is a command line interface which provides you high level command line interface for package management system so apt is the packet manager of the ubuntu right but for different flavors you have different packet managers so let's say if i search for package managers in in linux so it will give me different packet managers so let's say apt is for is for ubuntu em is for centos d package is for another oh another linux linux flavor rpm is for red hat linux and dnf is for debian so all of this are different package managers for different linux flavors right yeah so we are using ubuntu here so we are using ubuntu here so we are going to use the apt package manager right so if i show you let's see now you say apt and i've seen one is npt dash get apt get is for different linux flavors okay okay so you have all the different types like apt apt-get m rpm dnf pac-man synaptic zip aptitude all of the different stuff so if you're using let's say you're using amazon linux ami so amazon linux is based on fedora and fedora uses the yum package so let's say if i search for uh install docker on on amazon linux ami so amazon linux ami all right so i'm going to get this blog here and they're going to show me so if you see here it it says sudo m update sudo m search sudo m info right so you can see that yum is the packet manager so you do sudo m install docker if i copy this command and i paste it in my in my terminal which is not amazon linux which is not fedora or centos it is this is a ubuntu image so if i paste this i'm going to get an error and if i i'm getting a prompt to enter the password because i'm using sudo and i'm also going to tell you about what sudo actually is so if i press enter it says that command not found for yum but if i do sudo apt install docker so i already have docker installed but i'll still get the output so if i do sudo apd docker install it will say tell me that okay this is the packages which will be installed and if you are sure you want to continue just press y so it is going to install some of this stuff that is only 58 uh kb so i'm going to press enter y and press enter so it is going to install all of the stuff required for my docker so now you can see that docker has installed right because i'm using the apt packet manager i cannot do it through yum packet manager because that is not used in ubuntu but the command is stream so if you use yum you just have to type in sudo um install docker or if you are using ubuntu you just need to change the package manager but the command is same so yeah you can install it do you install as a user or a rule as a normal user so you can do it with your normal user as well but most of the time there is an issue like there is an issue something like this right so there is an issue like this which says permission denied so if you want to do the task and you don't want to get an error like this so there might be a term where i'm using the nasi user and i don't get i i get an error here right i don't want to get an error if i don't want to get an error i can run sudo sudo means super user do so super user or the root account root user it has all the privileges it has all the permissions so if you're using sudo you are using a root account to perform that task so if i do sudo apt install docker it is not going to ask me for any like it is not going to show me any permission denied errors and it is also asking me are you root so if i do sudo apt install it is going to run the command as it is so it it has run the command and it says now that suit zero updated zero installed and zero to remove right so you're doing sudo apt you can install any packages you want you just need to know the package name and if you're not sure you can always use google like let's say if you want to install git in uh install get an ubuntu you can just do install git in ubuntu and you will get the package name so if you go here at atlantian uh block it will go it will show you the command so let's say go here and scroll down so it is going to this is for the mac mac has the package installed or package manager which is brew this is the max package manager but if you scroll down you can see that [Music] there is going to be a command which is installing get so you can see sudo apt-get update and sudo apt get installed get right so if i do sudo apt install gate i will get the uh i will get the status or i will get the output and it is showing me that zero updated seo installed because i already have the git installed here so git is already installed gate is already the newest version so you can download any packages you want with this command sudo apt and even if you let's say you have packages installed and you are working on any linux machine the first thing you should do is update all the packages so you can sudo apt update and it will give you all the updates like what what are the updates present and if you want to upgrade it you can do sudo ability upgrade but let's do it all in a single command so both the commands in a single command so sudo apt update and sudo apt upgrade so if i run this it is going to update and upgrade all the packages that i have here so i have all the packages likes universe like docker and is saying me that it is asking me for 526 mb so i'm going to press y and it will start updating all the packages so dev stable kden live kubernetes updates so amd64 libcom all the packages that i have here is going to be updated and upgraded right so now we have learned about the packet managers like how to install packages in linux how to update them how to upgrade them right and if you want to let's say delete one of the packages so for that you have a command name as sudo apt purge or sudo apt-clean so let me show you that with then once i have done this so if you want let's say you are working you can also click here to open a new terminal right so so if i want to let's say delete any of the packages so i want i can do this by sudo apt purge and and i can press here so it will give me the options like what do i need to enter so like sudo apt purge and get so it is showing me an error because this is working this is going on the process is going on here and let's wait so it decided that it is held by a process the pseudo apt is held by process so we have to wait for it to complete so let's wait we can also close the terminal here and let's wait so it is 65 percent done it is it is updating the packages for brave browser which i'm using so ubuntu is the most common and the most used linux most simplest as well so if you're starting out and if you using linux i would recommend you to use ubuntu once you get the idea of ubuntu then you can try out like other flavors maybe a kali linux maybe fedora or arc linux anything you want but start with ubuntu ubuntu the simplest you also have the graphical user interface like in windows you can also choose to do it graphically but if you are using linux i would recommend you to go with the terminal because you get a lot of permissions you get a lot of features using terminals that you now know right you now have learned about all the file commands you have learned about the copy move rename and delete commands you also know about the installing packages command so now uh you already when you create an aws instance if you want to connect it you use putty or the uh mbox term right which yeah yeah yeah so when you use windows you use putty or the other third party tools to connect to the instance that is there on the aws account right so we also call this ssh connection because we put in the we we browse the file and we find our key file and we paste it there right and then we are connected to the instance so in so that is the graphical user interface where you open the installer and then you load your key then you enter your ip address you enter your username so all of that is a graphical user interface but the same thing you can do it using using the terminal as well so for that you have a command which is ssh which also stands for secure shell login right so ssh stands for secure shell and i am going to teach you like how you can connect to an ubuntu instance or any linux instance that is there on the uh on the aws so let's go ahead and launch an instance first so i'm going to go here and sign into my open amazon account so all right so i'm going to go here and i'm going to if i want i can do it through terraform but just to get it done correct fastly so i'm going to use it so if you or else we can if you want we can do it through but we have to type in the key and all the other stuff so let's go this one is okay my server let's give it a name my server and i'm choosing ubuntu i am going to use t2 micro i'm going to use my key which i have demo i guess i have it somewhere safe yeah i have it in demo key so and all the other stuff i'm only allowing ssh okay okay and i'm going to create an instance so in some time this instance will be created and we can use ssh command to go into this instance directly using our using our terminal so but for that we have to have the file present in our in our computer so you can see that i have a demo key file present which is here inside my folder so let's see if it is done or not so it's almost done and 99 so this is how you update our pdf file so now i have everything upgraded everything is up to date now all of there are on in latest versions so let me clear it out and let me go back to the folder where my key is present so if i do cd i'm back into my home directory if i do ls i should see a folder so let me search where my demo key is again so it is in home and messy folder so let's go to this demo key demo key demo key all right so you can see that i have a key here demo key dot pen right so let me wait for it to come up so for it to running so the command or the syntax is ssh sorry ssh username address so this is the syntax like how you can connect so for here the username is going to be ubuntu and the ip address is going to my ip address which is this one here so if i go here and click on connect you'll get the command as well so if i go here and so you can see that this is the command which has the username at the rate you can also use your public domain public dns or you can also use your ip address so if i copy this i can get the same same but i'm going to type it type in everything but you can see here the hyphen i which is asking us for the demo key or the key file so let's use that but before that let's see if our instance is up or not so it is still initializing but let's try to connect it anyways so i'm going to copy this here and i'm going to run ssh hyphen i what is my key file so i can run so i can give the path of the key file which is demo key dot pim and i'm going to type in the username which is ubuntu at the rate so at the rate the name of the uh the ip address so if i pass in here enter it will ask me are you sure you want to continue connecting yes i am sure so if i do yes i should be inside my instance so you can see that i am inside my instance the username is ubuntu and this is the host or the ip address so now you can see that i am inside my ubuntu instance i can do anything i want so you can you have learned ssh command ssh is a command which will help you to remote logging into any server that is there inside unless so if you have the key file or if you have so this one was the protected so this one was protected this was one not public so i needed a key file but most of the servers all over the world they might be public so you might not need any key file you can just do it by ssh username and uh at the rate the host so you heard it was the ip address it can be anything so this command so if i do man ssh here you can get a lot detail about it as well so open sss remote login client you can remote logging into any server just by using this command and this is one of the most important command if you're working as a cloud or devops engineer because you will be remote logging into the instances or into any others machines to maybe configure or do some tasks right so now you have learned ls command you have learn make directory command to create a directory which is test so you have learn the command to create a file touch file dot txt so now so this is it has created a file you have run a command you have learn a command to remove the file so this one has removed it now and you have blender command to ssh you have learned a command to install anything so let's say i want to install sudo apt installed docker right so it will start installing docker now so it says unable to package stalker so let's go and install git so you need to know like what is the exact uh package name so it says git is already installed so using apt you can install you can also use apt2 sudo apt update yeah you can use both in a single line but you have to pass in the uh and sign to separate so you can run two commands in a single file like sudo apt update and sudo apt upgrade right so this will also update and upgrade the files so i don't want to waste time so i'm not going to do it so let's say if i want to create a file and create a directory and go inside it in it so i can do mkdir test 2 and i also want to go in it so i also want to let's say create a file in it so touch file one so i have to pass in the full path so which is going to be test to hyphen file dot txt so this command is going to create a mk directory uh which is test2 and it is also going to create a file in it so let's go inside this test2 file so test2 i am and if you see here you can see that file.txt is created as well so you can also use the pipe pipe is one of the separator as well to launch more like run more commands in a single line so now you use white so you can use pipe let's say like this echo so i have also taught you this in uh let me show you that so when we were like using the user data script you might have you might have seen it but let me show you that as well so i'm going to show you an example uh yes this one is here so if you see in this in this we are using a file pipe here so you can see here there is a pipe here yeah right so you can also use a file to have yes so no no you can use file to like you can use pipe to run more than one commands in a single line so now let's if you run exit i am going to go back into my own terminal the local terminal i am inside my ubuntu instance which was created so if i do exit i am back again to my home nasi that note right so it says connection has been closed so let's go and delete the instance first so i'm going to do and terminate the instance so now you have learned a lot and if you want to check like which commands have you run till now there's a command so let's first clear it out so there is a command to check what are the different commands you have run till now so if i do history i can see what i've done i have done history i have done clear so these are all the different commands that i have run so i can see like up to let me take the excuse for this one the command yeah you if you yeah you can take a screenshot or else i am recording this session right now if you want i can pronounce it so people can get help and i'm also going to sell it to someone because i have a few people who don't who cannot who don't have time to like attend sessions they want me to record it and give it to them so i'm going to do that so now you have learned a lot of this commands let's go and learn some of the commands that should be known to all the devops engineer so one of the command is first let's go to learn linux folder so i'm inside my loneliness folder so there might be a case where you're working on an application where you have to give the path of a certain file inside that application right there might be a scenario like this where you have let's say what do i have in here i have my my new file.txt right i want to give the path of my new file.txt inside inside an application or let's say to any developer who wants to know the path of my file dot txt how am i going to do this i can run this command pwd which stands for present working directory so it will give me the path from the start to the end so if i do it will go give me that path like i am in my home inside nasi inside learn linux and this is the path so if i let's say go in the test one and i run the pwd again again it is going to give give me the whole path for all of the uh whole path right and i can also use this path to let's say i want to delete my file dot new file.txt from anywhere so let's i'm here in my home directory now and i want to delete this my new file.txt i can copy this one here so let me copy it let me paste it and i can do let's say my new file.txt so i'm not i have not put in anything here so let's say i want to remove a file right so i have i in my learn linux i have my new file i can put it so using this path i can delete a file and let's say i do ls inside my learn linux i should get that my new file.txt has gone now so to check the far the path uh of the current working directory you can use pwd present working directory okay and if you want to know that who is the current user you can run this command who m i m i i m nasi so to check what is the user so if i want this command sudo su is going to change you from the user to the root user so if i run sudo su i'm going to ask they are going to ask me a password i'm going to enter the password and if you see here i am inside my i am logged in as a root user if i run who m i i am root right yeah so if i do exit i'm back again to my user and if i run who am i again so i'm going to get that i am nessie so if you want to check who is the user or what is the current user you can use who am i if you want to check the current path you are going to use the pwd if you want to check what are the different commands you have used till now you can use history command and let's say you want to you want to check if some packages are installed or not let's say i want to check if docker is installed or not i can just type in docker and if i get some output like this i get the options this means docker is installed or i can also check with docker hyphen iphone version which will give me the version of the of the tool which means that docker is installed right but let's say you you can also use this command which is which docker which will give you where docker is actually placed inside our machine so if i run witch docker it shows that docker is inside user slash pin slash docker this also tells you like docker is already installed but it also gives you the path of where the docker is present so i can also use this command to locate any other package so let's say which git git is also stored in the same package so i can run sudo apt update docker or anything or i can just run to update anything so like i can run to apt all or upgrade right so everything is going to be upgraded this command which is going to show you like where is it present so i can also run let's say i have do i have kubernetes i have cube ctl so which qbctl it is inside user local bin cube ctm right and there is another command date which is going to tell you the current date so it's july thursday 7 july and then you have you already know about nano now yeah so there's also another editor which is wem so let's go to the cd change directory to learn linux first so inside what do i have i have test let's create a file and let's create it with the use of web so i can also create and edit it at the same time so let's say i am creating a file.txt so dot txt so i am inside my wim editor now so if you see something like this it means you are inside a directory in a vim editor and it says that it is a new file which is created right now so if you want to edit something if i type in if i'm typing something but it is not showing me another so unless like it let me exit so just a second and okay so let's learn let's use dvi again so if i am typing anything it can say that no under cursor so if you want to actually start working with the vim editor you have to first type in the i comma i which stands for insert so let me let me let me go back again and to show you so if so now if i want to type in anything i just have to first type in y i in on my keyboard so once i type in i i can actually start working on it so i can create anything i want so this is my new file right and if i want to exit this editor i have to first press the escape key once i press the escape key i can do this colon as you can see here at the end wq means saving and exiting qa means qa in this marks means exiting without saving so now you might have seen that i already did the q a exclamation mark which has not saved anything but if i do w key and i press enter and if i do ls you can see that file has been created and if i do cat file.txt i can see whatever was written inside it yeah similar to nano but a bit complex because you you can get a file like this but if you start typing you cannot like do anything in it so you can see unless i type in i i cannot do anything in it right so it is a bit confusing and if you want to escape uh you have to type in like if you want to save it just type in wq if you don't want to save it so if you don't want to save it qa and this so this can be confusing but i would suggest you to use nano because nano is very very easy compared to vi but you can also use vi now because i have taught you vi okay so we have learned a lot of file commands lot of good to know commands and we have also learned about how to install how to ssh let's learn a bit about network commands which you might be using so network command one of them is the ping command ping is used to check if the connection is established or not so let's say i'm going to ping uh google google.com so if i am connected to my internet or if google.com is up and running right now it should give me response right so if i do enter you can see that it is giving me response so 64 bytes from this so google is giving me commands right so if i do control c i am going to exit this now if i do ping let's say let's say let's say amazon amazon.com so if amazon.com is up right now i can get i should get the packets back from them so you can see that 64 bytes are getting back from this which is the path or the ip address for amazon.com right so this is one of the command to check if there is a connection between the servers or not ping is one of the command if you want to check what is your ip address you can run this command it will give you the ip address so this is one so you can get the ip address so this is your ip address and the other details about the so it is also giving you the docker ip address here so another command is ns lookup so let's say i want to get the details about some domain uh which is let's say google.com maybe so i'm going to run google.com and it is giving me the ip address of it this is the ipv6 address and let's say i am going to get the so what can i search for any so shout me out is one of the blog so if i want to get the idea of what is so i can run here shout me loud and it will give me that this is the name this is the address this is the name this is the address so a bit more about what this host right so nslookup is one of the networking commands another command is curl command so if i want to get uh the contents so if i let's say if i do it graphically i can go here i can go to google.com and i what what can i see here i can see a logo google i can see a search box i can see google search i'm feeling like everything so i can do the same thing using commands as well so if i call google.com google.com i can see that so here it says the document has been moved so let's copy this here so curl and paste it so you can see that this is the same thing that is there but it is this is this is in form of html but still that you can see something so yeah google search which is same as here google search and you can also find something more like i am feeling lucky you can see it here so this is the same context but this is in the form of html this is how the websites are actually made so if you want to get the contents of the website or anything you can run curl command to actually get it right so let's take an example let's take an example of aws dot com so i am here inside my aws amazon.com if i want to get this get this hole without going to the website without searching it on the internet i can go here and let me clear it out first so i can do curl and paste the link so it will give me everything so if you can see that it is exactly what is shown on the on the website so if i scroll up to the so you can see that there was something like amazon builders library so if i do amazon builders so you can see amazon builders library here so this is the exact thing what is there but you can get the idea like you can get the contents of the website by running running the curl command so if you do do man curl you can get a lot more information about it so you can see that transfers a url is a tool to transfer data from one server to another and you can also use all the different uh components to get id about it so curl is to get the contents of the website right and there's another command which is wget so wget can be used to download the files right so let's say i want to download python in my in my in my machine ubuntu machine so i have already opened a website so if you go here so you can run this command w get and if i just open this you if i just open this it will start downloading this in my local machine so if i go to go to and it start it is downloading it my in my machine right but if i do this so let's say i want to w get and i paste it here let me erase this so dublicate is to get the package or whatever is there so it can be anything it can be a image file it can be a video it can be a package it can be anything you can download it using wget you just need to get the exact link which is actually downloading it all right so for the link you use the view game yeah no you don't get use wk to link to get the link you get you use wk to actually download it so now i am using this to like i am using it to open a file and this is done through graphical user interface right if i go here and i open it this is run through graphical interface so i have to save it and i have then it will start downloading right but i can do it the same way using wget so if i press enter here now it has start downloading it so you can see that it is downloading 3.52 mb or something and it says that it has been saved so if i do ls you can see so ls you can see that python is present here it means to get whatever you have pasted in the link for so non-interactive network downloader is a free utility for non-interactive download of files from the web so without going to the web you are actually downloading stuff you just need to have the link for it so i hope you have learned a lot about linux commands to
Info
Channel: Cloud Champ
Views: 36,599
Rating: undefined out of 5
Keywords: linux commands for devops, linux essentials for devops, linux basics for devops, important linux commands for devops, frequently used linux commands for devops, linux commands for devops beginners, devops engineer linux, basic linux commands, linux for aws and devops, hands on linux commands, shell scripting for devops, important linux commands, linux interview questions, linux for aws, linux for devops, linux commands course, linux command in ubuntu, linux devops training, aws
Id: lCq4mYQL0WY
Channel Id: undefined
Length: 57min 19sec (3439 seconds)
Published: Thu Jul 07 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.