Linux Tutorial For Beginners - 2 | Linux System Administration | Linux Training | Edureka

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi guys so welcome back to our Rock denounce tutorial webinar so we spoke about few of these topics yesterday so we spoke about the basic commands in the next verse and then we spoke about how to manage files and then I spoke about how to manage for our directories right and in today's session we're going to talk about these topics all right I'm going to talk about advanced repositories how to create dart files how to compress files and how to decompress files and I'll talk about what our environment variables that is speak about regular expressions and then another important topic our talk about is data processes right so how do you kill processes how do you create a new process how do you manage them how do you set priorities there and then I'll go on and talk about the managing users right so user management is an important aspect of our statehood administration so to speak about that and then finally finish off today's session by talking about the SH aspect so a search is used for networking all right so without wasting much time let's just get started all right so working with Linux repositories okay and it said that stable versions of most software's will already be available and enough suppositories and the command to install them is this so you would have heard me say earlier that very easy to update software and the operating system itself by just running one simple command right you can update the software so this is what I'm talking about so you can just run one command so this is the only command that you need to run okay if you just give sudo yum install and if you give the package name then that particular package will get updated okay the sudo something that you would recognize from what I told you earlier this row is to be given to to execute this command as a root user okay and if you see that there are two other lines and the only difference between these three lines is the letter that the word we are using here okay so in the first case in case of any Red Hat Enterprise Linux system or even send to s right which falls under Red Hat we use yum okay but if it's a Debian based system like Ubuntu or everyone to x12 or any any other Debian Linux system then you would have to use apt I forget okay and then if you're using a federal basis then you go to use a DNF okay so these are the three different commands and these are the that's because the repository name for rel it's called as the yum repository and the repository name for debian is called as the app repository okay and for federal is called DNF repository so that's why we say we are first we will have to first give the pseudo sudo command which would make sure that we execute this command as the root user and from the command perspective the first part would be calling or referring to the repository okay so from the Centaurs it would refer to the yum repository or from the ubuntu footage if I go apt-get it would refer to the healer app repository and then we have something called as install and then we say install and let's follow that by package name then that particular package will get installed so for example over here it is Java right I'm trying to show how to install Java on your system so in this case if you first give a young update then it will first full update your links to your repositories okay it would update the yum command and the links that you have between the repository and yourself so it's not something related to installation of Java okay this is just another command that you specify if any of your installation fails okay so this is not a compulsory your command that you need to run but besides that what you have is yum install Java one point 8.0 I have an open JDK now what the pack isn't or you see oh right that is Java so if I want to install Java then I would just give this particular package name and I would say install okay because the package name of Java that's present in the Linux repository that is called as Java one point eight point zero opens you detail and similarly if you want to install any other software right a few Juanes insulin is a technology like how do then you can just give one such package name you just got to find out what is the name of the package that they have in the repository you can just simply google it and it will give you the package name and you can just say yum install or sudo yum install for by packaging followed by Hadoop - 2.0 or two point three point zero or very soon out of three point zero is coming so you can say how do - 3.0 something like that and yeah if it's if you want install docker then again you can take sudo yum install docker and probably the version in I don't think doctor needs a version though and for ensuring docker you can do it also through good okay so when I install docker in my other open to VM right which I showed you earlier so that VM has the docker installed and the command that I ran that time was sudo apt-get install docker and that downloaded and installed the latest version of docker that was available in the repository okay yes so that is it and once you're done with the installation it would take quite some time to install and once I know everything is done then you love to just you know update your environment variables okay you have to set the innominate variables over here in your dot bash RC file and once you set the UNAM and path over there then you can just do source and then your software is already it's installed okay now this is another step which I skipped out because this is not really necessary for you to execute this okay I'll tell you why because this command which is update - alternatives - - conflict Java it is only to select a particular version of Java now let's say that you're new to Linux okay and you're downloading job for the first time then you just need to run this command so after running this command you can straight away just you know probably when you're done with this Java installed basically okay but it is that you need to go to your rows sudo we should do sudo G edit for your bash RC file and update the path where Java is installed okay you got to specify it your environment variables your runtime engine that Java has been installed in this path so you have to just copy the path of your Java and paste it in the environment variables over here and then you have to source that particular bash RC so when you are done with these two things your Java is installed okay but if you already have a Java package installed okay so in my case when I will be showing you this now I already have a Java 1.7 package okay so now if I do a sudo yum install Java one point 8.0 open JDK then I'll have multiple versions of Java okay and my environment variables would be currently set to Java 1.7 because that's what I already have but since you have you know multiple versions of Java and since there are different packages you can have multiple packages of Java installed but can only run one of them okay so you set which one you want to run right that one you set over here whether I want to choose to work you type in or whether I want to choose to execute it that I can choose by your updating over here so I'll show you this command also okay so that is what I want to show you with respect to our next repositories so similarly you can even you know you can do a sudo yum install PHP if you want to install your PHP server you can just say VST my sequel server if you want to install any other software like W get you can do that also so this is what we are saying you know it's very simple to install software so if you're doing it with the GUI then you will have a lot of steps that you need to do you need to go to the website download the appropriate package then extract them then install them all those things so instead this is just simpler and it's much faster okay now let me go back to my terminal and show you how that is done okay so I'm going to go to my CD and the command is sorrow young install and now would come to Java package so the package I'm going to install is Java one point eight point zero okay that's because Java 8 is a place with this name okay so the package name of Java it in the Linux repositories is Java - one point eight point zero - open JDK now when I hit enter it asks for the password because this particular sorry for that guys when I use sudo to execute this particular command then it ask for a password because I am executing this as a root user so that's why if I try executing this as the local user as my own user then it wouldn't be possible to execute this command okay I have to execute this as a root user and the root user is one that has the ultimate privileges the ultimate access he has access to everything so you just enter the password and put enter then automatically your packages we get downloaded and it will get installed so now it says you know turtle download size is 33 mb and it asks is it okay to download voice and for yes and n stands for no now if it's you when you're turned on word Java when you give this command you got to say Y and hit end up because that would download the third 3eme package and install it on your Linux machine okay but however I have already download Java and since I've done it already so I don't need to okay I don't want to waste my time here because this is session right I don't want to waste your precious time so what I'm going to do is I'm just going to click on end and give enter is it fine Siddarth a month all you guys were in a session is it fine because I want to say sometime you by hitting n okay because otherwise it would take some time to set up the installation process so okay fine yeah and we're going to guess from you both alright so I'm just going to click on no okay so it says exiting on the user command grid yeah so the one thing you will notice that in row pen if you put Y and a few hit enter it will download for you and you would complete the installation all right and there's one noting that I would actually like to add to this so pulling while installing the same package right while doing the sudo yum install Java this package when you are trying to run this command if you want this why often to be chosen automatically okay because right now it entered into the interactive mode okay a tractor motors when the colonel was asking you should you download this and do you want to download this an executed data and I had to press N and get out of it okay but however you might not want to okay so there may be times when you might want to by default this click on yes so what you can do at that time is you can just go back here sorrow young you you have a flag up you can just put - why and if you then install it then it would not ask you it will not get into this interactive mode so it will take this why white flag why option automatically and it will you know install the java package so that is what I wanted to show you that's what I want to tell you so that's how you install java okay so now I'll just clear the screen guys okay so the when you execute this command in your Linux machine and when you finish downloading an installation of your java what you going to do is you go to set your anomic variables okay so as it was written in the slide right you go to group this row G edit dot bash RC to enter into the bash RC file and set the innominate variables you have the path to where your Java is installed okay so what I'm going to do is I'm going to do the same - and your dot path a fee is something that will be present only in your home directory okay so we got to remember to go to CD and from CD you got to access that you got to say it su ro G edit space dot bash RC when you do this it'll ask you for the password but of course I have to enter the password previously so would you ask me but yeah when you do that you will open this battery file okay so right now my Java path is set to this okay so this means when during runtime and any application is using or requesting for Java then it would look for Java in this path so you just need to find out where your Java has been installed in your system so it would most probably be in your user slash slip slash JVM folder okay so let me go to the same so it will be there under your root directory so if you go to your my computer from your file system under the lib folder we have various packages that will all be installed over here okay so on my system it all installed over here so this is the GBM folder and inside you have all the different Java packages which I have downloaded over your time so guys uh in this case supposing CI have Java 1.7 point 0 open JDK installed ok now in your case you will have a Java one point 8.0 open JDK installed so what you go to do is you go to just right click on that folder ok similar to what I'm doing now ok I'm going to right click and I just click on copy and go here and paste the path over here ok if ending existing already then remove that and paste the new path so the past is nothing but where your JVM is located from your root so it's in route us our library folder and then inside libraries and JVM and yes this is the folder it's predator ok and then you got to also originally give the path to your bin directory ok so you have this you have been directory so what do you do is you right click on pin again copy go to your dot bash RC ok you go to paste over here alright so this is how this is what you do this is our simple it is so when you do it you go to save it and you go to you know closes dot bash RC file and when you are done with saving and closing it just go back to your terminal and you go to run this command source dot bash RC okay so when you do this then your term will get synced with the updated endowment variables otherwise even if you don't run it it's fine you can just start executing your commands from a new terminal then it Robbie fine but yeah the source dot batteries no need to sync your innominate variables with this particular terminal that is opened okay so that's how you install Java in your system okay guys so I'm just going to clear the screen now okay and I'm going to go back to my slides okay so I'm done with showing you how to work with Linux repositories and the next topic that I'm going to talk about is that of Todd files so what are tar files okay so all of you Windows users might be aware of this software called WinZip or WinRAR okay what are they what do they do they are basically to extract your files right so they'll be in compressed form and you have to extract them so in Jeanette's we have an equivalent for matter so in Linux it is either the tar file or the gzip and the gun zip files okay so tar is the preferred option so I'm going to show you how to compress and decompress the file with dot tar format but however even gzip and gunship is something that can be used if you want to compress a file is with the GZ format okay then you go to use this command but however if you are going or decompress it then you got to give guns oh okay and syntax is here okay but however with you for both compressing and decompressing you will use the same tar command itself so you'll just have dot and in the arguments there will be a minor change so when you're compressing the file you will have to specify - see okay and when you are raw decompressing the file you will have to give the flag - X otherwise it's all fine the we here stands for verbose and the F here indicates that you want to compress the file that is dimensioned followed by your D command here okay so this F just basically indicates that you go to compress this particular file otherwise the kernel will be wondering which file to compress and it will throw an error - later okay so that is what the X we have your stand for these are the different flags that are available with the Stars command okay okay before I go and show you how to do the started me show you a place where dart files will be your present so in Linux right no matter what kind of software downloading whether it's a Java package or if it's a Hadoop package if you are downloading them manually from the internet okay then you would get them in the dot tar format okay or you might find them in tdz format okay so tar is something the most I mean I would prefer if you people download tar because that's the easiest I see this to extract and you know also compress them so again just download the tar file it's very common and you can just buy this running this one command you can compress the file so the Hadoop packages that are available on a fasces website right that would almost be around 2 or 3 GB but you the company's format will only be around 100 or 200 MB okay so same thing can be said for something like Tomcat if you're downloading the Tomcat package order and nag yours so anything of that so those packages would have a lot of MB and to download them you will need to compress em right so because the lesser you download the more you save on bandwidth so it's also easier to transfer them in a compressed format so for transferring especially you use the star files ok you compress them into tar format and then later when you're done downloading you can extract them and bring them to regular file format so I'll show you how that is done so first of all let me go to my terminal and let's go to the Documents folder ok here I'm doing an LS we have this so what I'm going to do now is I'm gonna fit LS - L ok when I run this you can see the different files and the size ok you can see that the LMS folder right then let's folder here it has its the highest ok it's showing it's 4 4 4 0 9 6 MB so what we can do is I'm going to show you how to compress this and convert it into a tar file so to convert it into a tar file you go to say tar - CBF okay X is when you're trying to decompress it but CVS is when you're trying to compress it so you're going to say dot - CBS and then here comes the tar file name so what you want be the name of the tar file ok so I just want to have it as LM s dot dot ok so this is the name of the file I want to keep so I will put that here and then you go to specify the file which you want to compress whether it's LMS or than in the folder so I want to do it for LMS so I can just say LMS okay and when I have run this command then this particular document would have been compressed and it's present okay so if I do an LS now you can see that there is an LMS folder and an LMS tar file okay so this is the compressed version of this folder now when I do an LS LS minus del command you see that there is a new tar file that's created okay LMS dot dot and then you have this folder who is the tar file this one is so that's how simple it is guys and what it can do now is a few you can just transfer this file over FTP or via SSH or you know just upload this to your internet and let people download this because this is a smaller file compact with this proper folder right now in case you want to extract a file so in case you have downloaded this kind of a tar file okay from the Internet how will you untie it what is the package to not decompress it so to answer that question I can we can give the command start - XPS and the package name so in my case it's LMS so when I just do this and when I hit enter then that package would get extracted so now if I do an LS command you can see that this particular tar file has been extracted but you can see two different folders because the existing elements folder has been rewritten okay so it has been well let's just say it has been overwritten and that's why you can't take two different files but yeah as you can see this was the process which was taken to an tar the LMS package okay so that's it with respect to the compressing and decompressing of files so let me quickly go to the next topic in my slide okay so the next topic is that of environment variables so what our environment variables I told you that we had to set the environment variables in the god bash hostage file right while installing Java so what are they as the definition says your element variables control the behavior of the software packages in salt in Linux okay the path where the packages happen in salt that we specified in the anomic variables so if you are installing Java okay and if there is some other application which needs Java let's take the example of Hadoop okay so Hadoop is basically a Java framework okay so the MapReduce concepts it's all Java related and you need Java to run Hadoop otherwise it will not run out so by this downloading the Hadoop tar file from the internet and extracting that tar file is not enough okay what you going to do is you got to download Java also and set the environment variables for both Java and for Hadoop so in our case when Hadoop is running because it's based on the Java framework it would need Java to work right so at times it allows the runtime engine where is Java installed so that I need some commands to be run on Java so at that time when the runtime engine is large that kind of a question it will go to the environment variables and it will look for the path over there ok so that was the innominate variables i was talking about earlier okay you go and set your environment variables in your dot pacify and your dot passes a file can be accessed by going to your home directory from your home directory just run G edit dot bash RC ok and here you can set your path so if you've installed how do presently then you can just set the path of a loop over here and if you've installed Java then you can set the path of Java over here so basically whenever any other application once access to some program right so it can get access by looking at its path from here so that's what the bash RC file is all about ok that's what the UNAM Invisibles are all about so that was about the UNAM and variables and we have some of the most common endowment variables are these ok but in env so this will basically lists or prints the list of all the anomic variables ok all or almost all the anomaly variables that's what this will do and then when you say echo you know dollar home this will print at the path of the home directory of the user so this HOA me that you see here this is a variable ok and the path of your home directory has been specified over here so whenever you press CD on your terminal right so it goes to the home directory correct so that is the home the tree I'm talking about over here and the path of that this water is set over here so when you say echo dollar home like I told you earlier I show you that echo will basically print what about arguments ago but we print it to sign and output right so when you say echo daughter home it will print the paths of your home whatever stored in this variable and similarly when you give a coal dollar path then it will print the list of all the directories in which the shell looks for commands okay and all those directories will be separated by your colon okay so you'll have multiple Diaries which we get as the result and they will all be separated by a colon okay and similarly for hostname whatever the rim of your host of your system all right that will be printed when you give this because the second is a variable and this is all set as a nominal variables okay and then you have user name your user name will be printed so and when we say language it's basically the language right in which the whole system works and can be as a Chinese or can be English so in our case lot be English read score because we are all working on English so it will all print either US English or you can give something like that and when you say a coke - version this will print the version of this instance of bash so let's just go ahead and view some of these innominate variables okay I'm going to clear the screen and go to CD clear the screen and the first of all let's put dollar or let's say echo when you go back oh you have nothing okay I showed you earlier that when you just put an echo and then you say hi you will get high as you return the output will be high so similarly when you say echo dollar X right I set the path of X to week 200 earlier so when when I say this right X I will get the value of 100 now and similarly the path of whom will already be set so if I just give echo and dollar path then all the directories where the shell will look for to execute commands those possibly present you so scoop is located over here in this bin path and separated by a colon we have the next thing so I haven't taken my system so pig is installed here whoo Z is installed here I was installed here okay and similarly if you see Java Java is installed here okay and Hadoop to point 2.0 that's installed over here right and similarly there are all the directories where your shell will look for right they will all be specified in this spot so similarly you have another command that is for home this will print the home directory and my home directory is home slash head Rekha you can also alternatively print your host name right so my hosting is local host dot local admin ok so this is my host name right so my basically my host name is local host so that's what's being printed here and when I say echo and follow that with language okay with a dollar then it would print the language so this is a using English USA English okay Udyr 4 - 8 so that's what this means and in case you want to print the list of all the innominate variables then you can just run this command print PNB okay so all the UNAM and variables that are there in a system they will all be displayed here ok so that's it with respect to environment variables let me get back to my slides now and continue with my session so going on to the next slide now I'm going to talk about regular expressions okay so regular expressions or regex they are used to search through data it can be piped along with the grep command to find patterns of text in the file okay now what this means is that you will have multiple different files or multiple a lot of data and probably even 1/5 okay with the help of regular expression what you can do is you can search for patterns of that data so you can use the graph to search through data and you can use the regular expressions to search through patterns of data that kind of a pattern supposing you have a spelling mistake in the middle okay supposing the spelling of a Polizzi a PP le ok and you know you might have made a mistake in one of the files you have save it as a ple okay and you're not able to find when you're using Apple dat ple you're not able to find that actual string okay then it's you be wondering why you're not able to find it okay then you realize that okay it may be because the spelling that arrived entered in the file it's that might be wrong by mistake or event or a ple so in that kind of situation you can use regular expressions to find patterns of text in the file so you're all aware of the pipe I spoke about earlier right you can use the pipe to use one operations output as the input to another operation right so you can use that and you can use the expressions with the combination of grep okay with the combination of grep command so we have a lot of regular expressions and the most common of them are these okay so the dot here it basically means it can replace any character okay it can mean any cutter the dot so and then you have the calots symbol you're so the calyx symbol here it basically matches the start of the string okay now what that means is do you an example supposing you're doing a chat file one dot txt or looking for some kind of data inside this file on dot DX see and using the grep command to search this data cattle basically this down all the file contents grep will search that data and how will it search when you give a it will just display you know all the lines or all the words where a is present but when you give calotype it means that the starting of the string starts with a supposing I have three different lines or three different strings in my document in my file one dot txt okay so putting a half bar ABC ya f g and ADF okay and if I give carrot a then the result that will be out would be your goon given back to me those three lines because those three lines are starting with the character a so that's what this character means it matches the start of the string okay so that's about calop and similarly if you want to match something with the end of the string you can use the dollar symbol and supposing you know that this particular word or string that you're searching for it ends with X T okay in that case you can put X C and then you can suffix that with a dollar then all the strings in that particular file you know which are although all the strings in that file which are ending with X T they will be displayed okay so that's how you can search for data and similarly if you give a strict astrick basically means that the character that is you know preceding the preceding character is it matches zero or more times so let's take an example of for this okay now in this case we have J in front of the a string okay so the aspect basically means preceding character math is zero or more times supposing I have got two different strings in my file okay one string is ABC and the second string is des so then comes the asterisk okay so when as wicked basically means that the preceding character it occurs zero or more times but however if you give a question mark it means that the candidate that comes up proceeding before the quest mark that appears exactly one or it can appear more times okay and then you have you know these brackets or which can be used to group these regular expressions supposing you have you know more than one or two extra clear expressions you can use them to group them and again the backslash R it represents special characters okay so let me just run a couple of examples of this for you okay let me go to my terminal and go to my home directory I'm gonna clear the screen I will go to documents okay so in here I have my three different text documents automobiles file1 and file2 so if I do cat and automobiles or txt then I have a list of all these strings right I have address of all the cars and bikes and different automobile companies so what I'm going to do is I'm going to say it cat automobiles dot txt and I'm going to use a pipe I'm going to use a grip command to search for strings starting with the letter A okay so if I give it then all the strings where there is a present that will appear okay now first let me show you without the regular expression so when I give it then these are the strings where is present okay however if I give grep - V then it will list down those strings where J is not present okay so you might see a present in these two things but the truth is it's looking for small it okay if you want case-insensitive searching then you can just use I also alright so you can see as you can see from here in these four strings a is not present right so that kind of searching is what we need to do so I can use a regular expression to search for those strings starting with a particular character okay by using the cat command so in if you take this example so these are the list of strings in which a is present right so in here is a starting okay so is probably starting only in this one particular drawstring okay but maybe also over here but because I haven't included the in case-insensitive so what I'm going to do is I'm going to remove this Ruby once I'm going to print it okay this do a control L and X cubed again so now if you see all the strings where he is present whether it's a capital A or small it those will be listed here okay and now I can use a regular expression to basically filter out those letters or those strings which are starting with a okay why you're specifying this card okay so I have to ideally get the answer should get as earlier or the and above okay so when I hit enter okay so there's a space here so that's the problem and as you can see it says that there is no string that's matching with this a okay no that's because I removed the - I okay I removed the - I which stands for case insensitive searching so it basically returns that it's not returning any result here so that basically means the would there was no search but however if I add - I okay - I and enter then I will get these three as - ORS because I have added the case insensitive searching here so data alga is getting this concept of using regular expression of you know this is carrot okay this matches the starting of the string now I can do something similar I can search for the end of the string okay now let's see again if I use a itself and if I cook dal or then it will look for all the strings which are ending with a okay so that's happening because of this problem the whole dollar a should come inside brackets okay I should be in quotation marks so that is thing so when I do this I'm not getting any result so similarly I can execute an under Rob command okay so another one involving regular expressions of aspect so what I'll do it I'll say grep - and let's say I want to search for the character itself okay so when I say a in asterisks so it when when I use this assets it basically means zero or more occurrence of a correct so I'm going to search for that from here and then I have to specify the filename over here so I'm not using any cat command and I'm not using a pipe to get data in over here okay so I'm just going to display the number of times that happens by specifying the file name here I'm going to say automobiles on TXE when I hit an enter I get all the occurrences where zero one more times is a occurring okay so that is one aspect and the other command that I can show you is that of with respect to echo itself so I can run an echo instead flower brackets I can say he to Z now when I print this okay sorry there should be just two dots symbols so when we say to dot some is it means me fills the characters the sequence of a BC abcdefgh you know the entire alphabetical sequence that 11 as you can see so that's because they were just two dots specified but has there been three this won't happen okay it will just display this whole thing again so the thing you want to notice that the regular expression that we are using here is this one two dots okay so similarly you can replace it with even numbers so we can have 89 and you can say 33 so from 33 to 89 all the numbers will be you know the sequence of the numbers would be present here you can also have combinations like you know I can have say P over here and I can have Annie over here yeah when I do this the combination of a with all of these numbers would be invisible so as you can see so 833 be a 34 P so things like that right so patterns are also being generated so that is the advantage with some of these regular expressions okay so I'm going to want to clear the screen now and go on to the next topic okay so we are done with regular expressions out and this takes us to the final part of for this Linux demonstration okay this webinar and here we are going to talk about processes adding users and SSH alright so let's get started okay so guys processes is something that's really important from the administration perspective of the nose okay well it's I mean it's basically something that's necessarily not more than you know important thing it's most basically necessary I mean you should know what this is and when I say processes I'm pretty sure that you know that we are talking about the programs or instances of programs right so anything that you start on your raw system so whether you are starting with a browser or whatever crop how you're using a media player so everything every software that it will help causes involved okay there can be multiple instances of that particular project supposing I am viewing a presentation on my computer okay supposing I'm seeing five different resonation at the same time I mean I can see only one at a time but I can have the remaining open and I can put them in the background right so that's what we mean so the different instances of that particular system can also be considered as a process so at any point of time only one application or only one process will be in the foreground okay but many such instances of many software's or also of that particular software or program can be present in the background okay so the example of that is me opening two chrome browsers so I can have two different chrome windows and you know one can mean the background one can be in the foreground okay so similarly ppts or whether it's a media player anything like that so that's what a process is okay now when we definition an instance of a program is called a process all right any command given to the next kernel starts a new process and there can be multiple process of the same program they can be multiple processes when we say processes it basically means instances so we can have any number of four instances of any of your application right of Chrome or of VLC media player of all those things you can have multiple such instances at the same time and all these instances are referred to as processes okay official term is processes and each of those processes have some process ID okay so yeah like I told you they'll be divided two different processes one is the foreground processes and the other one is the background processes okay so how will you determine what are the different process that are running in your system in Windows you can just do control-alt-delete and then you will get the list of programs right and you can even terminate them you can end the programs from there right so you have different tabs so let me show you an example of that okay so this is my Windows system okay and when I do control-alt-delete it starts my task manager and it asks me for applications or processes and all these things so this is the process that I'm talking about okay you can have any number of process and running your system okay you might not be aware of all of those things so yeah anyways some may be started by you and some may not be started by you right some may be started at the system mood and some of those process might be started by you when you're running some command so that's what this is so every time you specify a command in the terminal or the kernel that will put a program or a software and that will also alternatively start a process okay and every time you started you will have a new process to fight and if you want to see the list of all the processes running in your system then you can use this top command okay and what you get followed by that will be the list of processes and they're a PID their user username their priority all these things so I will talk about all these aspects in some time so let me first show you the different things and how they look in the Linux in my VM okay so I'm going to run your I'm going to run the top command and when you do that you can see that you have something called as PID we have user you have PR you have a whole task button and we have with respect to which software is running which program is running what is the application name and all these things okay so right here you can't probably see anything that I have created on my own okay except for this virtual box client and maybe the terminal okay but if you want me to create one then I can also create one so what I'll do is I can just end this here by pressing the ctrl C I can get out of this top and what I'll do is I'll create a Firefox instance okay so Mozilla Firefox is installed in my system and through my terminal I will start Firefox okay when I hit enter my Firefox has been initiated okay see now I did not make any change okay I do not touch the Firefox icon but instead of that on its own mozilla firefox opened that is because I hit Firefox and I put enter the terminal so when I did that the Firefox open okay now I can just minimize this and if you go back to the terminal you will see that I am still inside the you know the terminal is assuming that I'm still working on Firefox okay I still not edit Firefox or that so when I when I close Firefox that's when I'll come out of the term lawyer but instead of for doing all that I can essentially do ctrl Z or ctrl W okay when I do ctrl Z it means that I am stopping my firefox instance okay so whatever firefox browser that was opened as i stopped the process however would not be stopped the process would be running in the background okay now supposing I want to push it if I want to bring it to the folk around I can just say for F G then I can give Firefox okay this will again initiate Firefox for me but otherwise I can just you know close it and I can push it also to the background I can say BG and I can say Firefox and if I could enter then my Firefox has been pushed to the background so now what I'll do is let me run that top command again and if you see over here the Firefox was not visible okay but since I started and pushed my Firefox with the background and all since I've done all these things my firefox will be visible in this list of processes okay now seems like I've send it to the background right so that's why it's not coming so let me hit Firefox again and it's opened the terminal now and what I'm going to do is of course it's in the background so I'm going to run the top command again and show you that Firefox is here so we have the Firefox here right as you can see there is a Firefox process that of course keeps moving up and down and it's all sorted by the priority that each process has okay so yeah so every single instance or every single program or application that you start right so they will be starting this way and they will have a process ID associated with them they will have the time for how long they have been instantiated they'll have the CP memories are using the virtual memory they are using and all these things okay so let me explain each of these things by going to my slide first so if I go back to my slides okay as you can see here these are the different blocks that you saw earlier okay on the terminal so the first PID stands for the process ID so each process that is initiated which will have a unique process ID okay and the user here is the name of the user who started that process and the PR is refers to the priority of that process because every process that is running in your raw UNIX it will have priority associated with that okay and the greatest the process is what will be executed first and that we execute at the top and then so along with the priority of that process you have the niceness value so niceness value is again you know the value of ranges from minus 20 to plus 20 and even the priority value it varies from minus 90 to plus 20 okay so basically the nicest value is somewhere it's opposite to priority okay so the lesser the nice value the greater will be the priority of your process you can also manually set the niceness value of your process to increase the priority if you want to give a particular program or a particular process mode priority then you can probably decrease the nicest value and that will lead to the increase in priority on your zone so that's what this is and then after that we have this VRT block okay so VR T stands for virtual memory re S stands for the physical memory s HR stands for the shared memory s is the status of the process so that's what X is so s speaks about the status of that particular process okay and then personate CPU is it is about the percentage of the CPU time okay and presage of the memory of the physical memory that's being used okay and then you have the time block which refers to the total CPU time that this process has been running for and then finally you have the command okay and that's fine and then after the command you will have the process that is actually running okay so let me just quickly go back to my thing here so the command is basically the application that's running okay so yeah that's about the different process I'm just going to end this top by going control Z when I go project this stops and I can just clear my screen so that's about my processes okay now I show you how the top command works okay now along with that if you want to see the list of all the processes that are running okay then you can see that by running this command PS - space UX or you can do this or you can even run PS - PID so when you do that you will only get the list of processes that are even being started by you okay so you're the user and the user and the my name is Ed Rekha right so all the processes which I have started right so all my processes will be visible of course the other users process will not be visible to me it will be only visible for him okay so I can also give PID otherwise PS PID okay the PS you exit busy displays the process that you have started okay so you any any program or anything that you started that you can see it here you can see you know what is the percentage of the memory that's being used because of that process what is the process ID for that particular process and all these things okay so similarly if you have you know anything else so that's what this command does okay the next thing that I want to tell you is that of running the PID of a particular process so you know that we've started the particular process okay we started the Firefox process that time and what I can do is I can find out the PID of that particular process by giving this command PID off and what is the name of the process so in my case it's Firefox so I'm just going to give PID off and Firefox that will give me the PID of that particular process five eight three six okay now I'm going to clear our screen okay I'm going to run the process again okay I'm going to start Firefox again and when I do this there is a new instance of Firefox that starts okay so a new process would have got started by now and when I just give control set I'm kind of stopping my process and now if I give PS - UX then you can see here that there's a new Firefox process that starts that's running okay the idea is zero six zero okay you can verify that by also giving by thing what is the answer that I get fi PID of Firefox when I do this I get 6 0 6 0 so that is what this is all about okay and if you see the status it's also showing as RTL okay this means that terminated that process okay so process of Firefox is I've been instantiated it has a PID of 6/0 6/0 okay and you know if I want to kill this process then I can give the command kill six zero six zero all right great so that's about the different process that I want to talk to you about okay so what's next is uh let me go back to the slides and talk about the next topic alright so I spoke about processes here and the next topic is this is the penultimate topic actually I'm going to tell you how to create your own users so you can create users by this comment simply saying pseudo user ID and the user name okay if you want to set password to that person then you got to say password and the user name of that passes and then it will prompt you to set a password for that person and simply if you want to delete that particular user you can say user delete and then the name of that user name whichever you want to delete okay but one thing is that you go to always use sudo before that because these commands cannot be executed by users like us okay we need a root access for that we need the only root users web the Super User permissions can not do this so that's why we use sudo and we enter the password okay now one thing you notice that when a user is created then by default is also added to a particular group okay there'll be sometimes there'll be a default group to which that post will be added and if you want to add a user to a particular group then you can just do that by using the usermod' command okay you can say user mod - g-g represents the group and then you can see the group name and the username so the group name that you want to set and followed by the user name of that particular person suppose you want to add your own groups then you can do that by group add and group in and then it will delete them it's again the same thing okay after this process then again you can assign them a different group okay so let me just show to you on my terminal okay so the first command is adding a user right so before anything let me just go to system go to administration and user and groups it ask for a password okay I'm going okay when you go that you see that there are two users currently so it Ricardo see so these are the two users and in groups again there are a drea and you see there are two groups here also now if I want to add users I can add it from here okay I can just I can click on add user and I can give the user name I can give the full name password and all these things from the GUI but you know the CLI is a more simpler version where I can just supply a command okay so I'm going to say user ad space I can give the name of the user so if I want to create a user for myself okay I can give this name using it user ad button okay but of course it's wrong going to work because it would say we need a pseudo access function tonight right so what I'll do is I'll give pseudo access it asks for the root password and when you give the password you don't have any argument so that means your user has been created successfully so if you go back to system and administration and if you go to user and groups you'll find that there's a new user that's added and the user ID is five not to okay now let me just minimize this for now similarly if you want to set a password for this user because right now it might not have a password if you want to set a password then you go to run this command sudo password and the username username is varbin so do this hit an enter it will say changing the new password for the user okay and let's say the new password is this and it will say it's retype the new password I can give it here and then the tokens are updated successfully okay password is updated successfully so that's what this is all about so if I go back to this user window and if I click on button then you'll know that there's a puzzle that's been added over here okay this is what I added from here and you'll also notice that there's a new home directory that's created for that post so all these things right so that's about creating a user supposing you want to create a new group then how will you do it similarly this say group add so I'm going to say a pseudo and then enter this so the group has been added successfully and if I go back to John the system under administration and our users and groups if I go to groups now even I NSC is something that's created so this version is something that got created done now because the island when you create a new user right when you create a user without you know by specifying in any group then automatically is added to a group so a group is created automatically when our users created and it is the same as the user name so that's how this got created but anyways this is the new group so I'm just going to do ctrl L and say ma if you want to delete any users it's again a very simple process you can just do a sudo and user delete and the name of that user okay if I want to delete button then I can do this yeah so I'm not able to delete it right now because one is currently logged in so if I just log off from this VM and if I log in as warden and log out from there and then as a root if I execute this command then I would be able to delete this user but the command is very simple this is the command and you can all try it at home alright and similarly if you want to delete any group again the commander is simple it's a group delete and then the name of the group that is a high n st here which I created so if you do this the group has will delete it now okay yeah as you can see now Insp is not visible okay so that was the previous window I hadn't refreshed it so now if you see I NSE is deleted so that's how you delete the group and that's how you delete a user all right so that's that brings us to an end to this topic so I'm just going to clear the screen and what I can do is I can just go back to my slides and get started with this final slide of mine so guys are this is the last topic for today that is the secure shell okay it's also called the SSH and this is for gaining remote access of a system okay so you can get access to a system which is remotely located so without you physically accessing that system you can get access through this SSH server okay so that's what the SSH does okay it's called secure shell the connection is called secured shell connection so all other topics in this session right today sessions there were all basic stuff which any user could learn but this one this SSH is something a little little little advanced and this is and this is with respect to networking okay you know it's a thing that people would look forward to okay so if it's you know if you guys are waiting for a long time and if you are feeling bored in the session then this is something that's going to be a little more fun you're going to do something real time and you're going to see something incredible happening okay by pinging and accessing some other machine so first of all how does secure shell work so we have two different systems right but in my case will be two different beams and in general it will be two different systems which are remotely located and you can get access to them by the help of this SSH and how is that possible by setting the IP address and all those things right you set the IP address and in two different places you set one system as the master and you set the other system as the slave and you basically what you do is you have something called as the EDC hosts okay so you go to this file and you set the master and the slave IP is over here okay you'll have to set up this IP for the master and this IP for the slave machine and then you can do the if configured the IP address hope to list down the IP address of that particular machine so if it's something other than what you want to set then you can just do that by deleting the existing IP table running this command in both the EEO machines and then to add an IP address to that machine you can run this command sudo IP add or add and the IP address you want to add okay so remember to set the mask for that and when you enter this command this particular IP address will be set for that particular node okay so that will be the master node and set this IP address for the slave node okay the command will be the same but before that you got to delete the IP address the existing one by this command and then add the new IP address at the same end with this command and then simply just type SSH master or slave okay so when you do that your secure connection would be established and you if you see the username then you realize that okay you're logged in into the different system okay that's what I want to show you now and that's what I'm going to do it but before that you might have some problems like firewalls and stuff for that okay if you have a firewall you can still set up an such connection okay but the problem is we'll have to generate RSA key and all and I don't want to do that gives it's a little more complicated and since you people have big knowledge I just want to show you by II turning the fireball off okay and to turn the G fireball off what you gotta do is you're going to drop the IVA table okay it will just stop your driveway table and this command will permanently disable your agreeable so this is with respect to Linux so when you do these two things then even get started all right so let me go to my VM and show you what are the two different machines that I will be pinging - okay as you can see so this is the VM which I was working on right so let's say cancel and I'm just going to minimize this terminal okay let me just close every other file and folder alright this is my terminal that's minimized so if you can see here you have something well as master written right so this is the master machine and if I go back to my virtual box you can see that this is the machine that's already running okay now this is the same machine which I will ping so I need to instantiate this slave machine also and even when you are pinging two different machines to remote machines or two machines in the same VM then what you go to do is you know you go to turn on both and you go to set the IP address in both places and then you go to ping them from there so let's just wait until the slave opens all right when it's launched we can start with our commands but in the meanwhile I can just go to my master terminal and I can go to the terminal and start executing my IP tables okay so let me check if my connections are all running you click on this ok now that both my network connections are on so what I'm going to do is I'm going to say if conflict okay so when you do an if conflict you get this kind of an output okay so you're at zero is the is your any the address is your network address translation okay on your s1 in my case it's at one but generally you people will not get a net one because this comes when you are running a VM okay so I have a setup of bridges adapter okay post earlier rapper actually where between my two beams so I have a master VM and our save VM right yeah since there are two VMs in the same machine I need to set different IP addresses for both the beams right so that's when at one comes into the picture otherwise in your case if you're running running Linux and you run this config tab then you will not get at one you'll only get at zero or you'll just get one option you get L not and we get ed view okay and this L not basically represents the energy address okay so this ten point oh point two point one five this basically is your IP address which you need to use to connect to the internet so if you don't get an address aware then it means you're not connected to the Internet okay so that's what this means and right now my h1 address is one ninety two dot one six zero at 56.2 okay and similarly if I go to my slave VM let me just log in here first as you can see from here it's a slave VL and if I launch my terminal what I'm going to do here is I'm going to run the command if config again right so right now it says that my okay I don't have a nine eight address okay and my network is not connected okay I have at one connection and that is one a two dot one sixty eight dot 56.2 okay but my nad address is not set so I think I'm just cutting it from the internet so what I'm going to do is I'm just going to click on system at zero and when I do this I'll be connected to the Internet now and I'm going to run this command again and now if you see I have the nad address okay so this is my network address ten dot 0 dot 2.15 and in case of my master VM ten dot zero dot dot one five was again the energy address okay it's the same but however the H one would have to be different okay I mean whether it's different or not I need to change my Y our h1 but now what matters is I'd open my slave from my master right so I need to drop whatever IP address is there right now so if this is the IP then have to drop this IP so even in your case by default there will be one random IP address you can drop that IP address by running one on the commands as I showed you in my slides I'll show you that again suddenly you go to do the same thing at even your master then you got to drop the IP over the earth one IP address and when you when you have done that you can set your new IP address so you will be setting two different IP addresses one for your master and one for your ro slave okay this you'll be setting one over here in this VM and you will be setting one over here and that address will be over here okay so I will make my as one ninety two dot one sixty eight dot 56.3 okay so I will drop this one and I'll update it as Daughtery and in fact master can be the same one ninety two dot one sixty eight water physics point two can be the you know the IP address off my master slave okay so I will use these two things and once I add these two IP addresses to the ATC slash hosts file then I can start pinging them okay I can start pinging them and I can get remote access to them alright so what I'll do is I first clear the screen and I'll go to my slave and again I'll do the same thing I'm going to clear the screen now so going back to my VM the first command that we go to run is we got to drop this particular IP address so to delete the IP address we have this kind sudo IP add a delete and then whatever the IP addresses okay so here this was the IP address right I'm going to drop the Edwin address so what I'm going to do is I'm going to put this here I'm going to say dev f1 now when I hit enter this particular IP address will be dropped okay okay this is the password okay now if I again run if conflict you can see that I don't have a net1 address that's because I dropped it over here correct let me just shoot you that's because I dropped this particular address okay now similarly let me run the same command in my slave also the commander's IP add or delete the IP address over here is one ninety two dot one sixty eight dot 56.2 okay so this is the same here also so I'm going to just pay secured and say de vh1 when I go enter okay I need to give sudo so that is a problem so I'm going to give sudo IP era and ask for the password there you go and yeah my IP address has been discarded okay now if I again run the if conflict you can see that each one again does not have any IP address now what I needed was I need to set my own IP address over here so let me first set the IP address over here it says in my this slave VM so to add the IP address the command is almost the same except that instead of delete you will have to put add okay and you will have to specify the IP address you want to set so I want to set one ninety two dot one sixty eight or 56.1 not to okay I'm going to say that will not do and then I need to give a mask so if you remember I told you that we need to give a mask so it will be slash 24 or let me give one not three because it is the slave right I can give one three here one or 3/24 when I give enter the IP address would have been added so if I do the if conflict now you can see that each one has this address 192 dot 168 what 56.1 not three this is what I added some time back right this is what I added here now similarly need to go back to my master bian and I've deleted the IP address from here I need to add the IP address or the new one okay so the command is add when I need to got 160 or 56.1 not to slash the mask that's 24 you vent up okay now let me check the if conflict as you can see the IP address for my h1 is there it's up and running now it's 192 dot 168 or 56.1 not too over here in this case okay now have another I have done this there's one more important thing that I need to do I need to add my IP addresses to the ETD slash hosts file which indicates to both the beams where the master is and what is the IP address of the master and what are the IP address of the slave okay now that I've added this one so let me just copy this address I'm going to copy this and I need to set this address of the master and similarly the address of the ER slave in the 83 slash hosts file okay how will you ask the ETD slash hosts file you need to first go to your home directory and from here okay let me clear the screen home directory so here you got to give a pseudo G edit / ET c / hosts okay when you hit enter you'll open this file okay this file is called the host / in easy file so in here you know I've already set my IP addresses okay now I can just delete it for name sake and I can just copy your paste what I had copied so it was 192 dot 168 what 56.1 not - this is the IP address of the master which I wanted to set correct if you see her this is the IP address that I added now and I'm adding this IP address dot 1 or 2 to the host I'm going to add that as master and so now if I go to the slave the IP addresses 192 168 56 and one not three okay now I need to go to the ECD file and since that is a slave I got to set the IPS for the safe and of course even the slave IP already set but I just up it and save it anyways I'm going to save this and I'm going to close this okay now similarly I need to go to the slave VM and set these two IP addresses okay now again the command has go to CD and go write sudo G edit / EDC's slash hosts okay so here also the IP address is set to 1 or 2 and 1 or 3 okay now this is the slave VM and the IP editor of this machine is 1 or 3 and the master is 1 or 2 okay that's the other way so I mean is the same so I don't need to make any changes yours um this one close this yeah I can just close it without saving now now that I've done this I can straight away start pinging or get SSH connection ok I can just say since this is the slave I can say SSH space master now since I've added the IP address of the master in the host table I don't need to specify the IP address of that particular system I can just say SH master and if I put enter then it will ask me for the masters password the other beams password is what I'm going to put here and when I put enter as you can see I'm logged in now so the password has been entered and you can see the last login you're ok so the last time I logged in was on this date and I logged in from this slave itself ok from this particular BMS F so to prove that this is the actual master what I can do is I can just go to CD and I can do an LS command ok I can go into any of these or desktop or the downloads or the pictures or folders right because I made quite a few changes in my master slave and turn the master slave is where I showed you the earlier files red I created the automobile dot exe the file 1 dot txt the file 2 dot txt okay if you can remember then my documents has these contents okay it has folder 1 it has automobile dot txt and all these things so I can just add the same to my slave so I can just navigate to desktop and if I do an LS I get the list of all these things ok so as you can see there is a the automobile dot txt and that readme file in my downloads folder ok now let me go to my master so in my master if I go to downloads I have these two files ok so this is what I mean when I say a remote access so these two VMs are communicating with each other such that the slave is accessing and it's running command inside the master and whatever is visible over there I get ax 2 here supposing you want me to open another file ok so the music folder has these three files right so I can these also a congestus a CD and go back one pot and say I'm gonna smooth change the music so when I go here and read one LS I have automobiles dot txt file one dot exe and 52.3 XD so basically these three text files are present in the other VM in the other machine okay they are present over here however they are not present in this machine if you want me to prove that they are not there in this machine then I can just minimize this go to the file directory go to music ok it's empty so this basically means that I'm accessing the master wheel from this slave VM ok alternatively you can also check the Downloads folder there's nothing here either so yeah that's how we login to the remote machine and in my case I've logged into slave from my machine and I have access these folders ok I can also view these quarters in this folder by going to cat automobiles or txt and when I hit enter whatever data set that I created earlier in the session right couple of hours back so those are visible over here ok so that's it so another thing is that if you want to exit from your masters machine right if you want to exit your exit shell then you can just hit exit ok when you hit exit it says a logout ok connection to master is closed so this shows that now we are back to your own OBM and now if you try going to CD and if you go to music or something you will not find any documents or any folders in that particular directory that's because it is your VM this is the slave VM and similarly I can just you know from my masters VM also I can get access to the slave VM by just typing in SSH and slave the password is this and this is the last time that was logged in and I'm here if I go to CD music and if I do an LS there's nothing available here okay that's because the slaves VM does not have anything in the music folder or anything in the Documents folder so that is the reason okay and similarly I can exit from here by giving this command exit it says it's logged out and connection to slave is closed okay guys so this is about the SSH and this is about the sector or shell connection there is something called as the RSA key okay now that is something that will get generated if there is a firewall so in my case I have blocked my firewall by dropping the IP tables okay so the command to drop the IP tables are this one there are service heart.we tables and stop ok this will drop the variable temporarily and if you want a permanently disabled type a table then you can just run the command sudo check conflict and IP tables off so by doing this your firewall will be turned off and you can use the SSH connection in the way I showed you okay now this is very simple of it but in case of a real scenario okay where the machine is located remotely where you cannot actually disable your firewall okay because firewall is important to block any unauthorized access right so firewall is important to be enabled so in that case if you want an SSH connection to be present in spite of a firewall then there is another procedure where we have to generate an SSH key write an RSA key from the Master Zen and said that turkey at the same end so you have that kind of process and that is something that's a little more complicated than this and of course that I can't show you now but I promise to show you that in my next the next webinar okay so a few days promise to come back and with me in that webinar then I can promise you to throat you there alright guys so I'm hoping that it's all fine I'm hoping that you people understood the concept here and it's been a good session spending pretty long but it's been worth it right basically came unto his new to computers and he says that you know he is got a lot of and I want to see the understood and next well and yeah he also says that he's going to install CentOS okay let him on that's good because even on this or Center is maybe this is why you want to install Center wise but don't just keep the cells for to this Center West human you can also install Ubuntu and find out which one you like so see I like the scent OS and this is my preferred Linux distribution okay so I recommend everything coupon to an Center West you you can install them and you work on them and you will only figure out which is better for you okay so I'm glad that you know some beginners and newcomers to this Linux world are getting something out of this session so yeah that brings us to the end of the session guys so let me conclude today's session then so first I started off by talking about the birth of Linux alright I told how it was born from UNIX and how it gained popularity and then I spoke with the different Linux distributions that you can choose from and then I start executing some of the basic Linux commands and then I we worked with files and directories you know the different and the basic commands with files and directories and then I showed you how to work with your next repositories how the tar files work how to set anomic variables and how to work with the help of regular expressions okay I showed all these things and then finally I finished great session by your talking about process setting up different users and secure shell connection so that's it for today guys yep so guys that brings us to the end of this session and if you guys have you know any doubts then you can put it now or you can ask you now right so ok I'm getting a thank you from a couple of people ok so thanks guys thank you for being part of the session and yeah it's more than me you tiny needs me thanking you people for you know being ever so nice and trying to understand whatever I try to teach you all ok so yeah I'll log off for today then ok thank you guys and happy learning all right so until the next time we meet ok we'll have a session again and that time I'll probably show you something more advanced and Linux all right till then bye I hope you enjoyed listening to this video please be kind enough to like it and you can comment any of your doubts and queries and we will reply to them at the earliest do look out for more videos in our playlist and subscribe to our at Eureka channel to learn more happy learning
Info
Channel: edureka!
Views: 211,625
Rating: undefined out of 5
Keywords: yt:cc=on, linux beginner tutorials, introduction to linux, linux tutorial for beginners, linux administration tutorial, linux tutorial, linux training, linux basic commands, linux training videos, linux training course, linux command line tutorial, ssh tutorial linux, linux shell scripting tutorial, linux update command, linux environment variables, linux regular expression tutorial, linux course for beginners, linux course online, edureka, linux administration edureka
Id: wtdFPppcup4
Channel Id: undefined
Length: 72min 33sec (4353 seconds)
Published: Tue May 30 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.