 Welcome back after lunch. We will continue with using Linux tool. So, unless there are questions from Kolhapur, we will, are there any questions from Kolhapur? Please ask your question. Sir, my question is regarding the relative pathing. When we give the absolute address, at that time we get the direct, direct the directory wherever you want to go. But when we are giving the relative address, at that time how we want to shift, because the same name can be there for the directories within the directories? Of course, of course. Yeah, yeah. Very, very good question. So, let me repeat the question. So, we have some path for each file. We have many directories. Many sub directories might have the same file. So, how do we locate, how do we give the exact path, absolute path, not just relative path, but absolute path? That is the question that we received from Kolhapur instead of technology Kolhapur. This indeed a very important question. So, whatever PWD gives is the present working directory. It gives the absolute path. So, please come back to this. So, we are here. So, what all is here? There is nothing. Let us go back. So, dot dot, when we say that dot dot denotes the parent directory and that is relative. Compared to where we are now, that is a current directory. It is one path back. Let us for example, go back to dir 3. So, cd dot dot is also the same as cd dot space dot dot. So, this is I mean dot dot means what? It is a parent of dot. Everything starts from current. At some situations it is obvious that current is there. You do not have to write it explicitly. But now let us see look at all the uncles. So, these are all the siblings of our parent. So, we have pressed tab there and it is showing these are the completions. We could go inside dir 2 and then again press tab. What is it that I am doing? I am pressing tab. There is nothing inside dir 2. So, let us go one more. So, this is all relative. The fact that you are using dot dot means, let us go back. This is current. Of the current we have gone to one parent. Of the parent we have gone to another parent. And now let us do tab. Now there is dir 1 and test files. Of course, dir 1 is expected. By doing two dots we are looking at inside desktop directory. What all is there further? Dir 1 has to be there. What else is there? Test files is there. That is what is coming when we press tab two times. Why do not we go inside test files? So, this all this way of navigation is what can be called relative. This is the question. If I understand right, this is the question. This is the location of various files, directories. This is all relative. What about absolute? This is absolute. PWD will always give if you specify the directory structure starting from slash means slash is the root. Starting from slash means it is absolute path. There is no dot dot etcetera specified here. We can go to another CD slash home slash belur slash desktop. We can use tab here also. Now we are specifying absolute path. Now we can press tab. Let us test files again press tab. So, this by saying CD is a command. After that you have to specify where to go. Now we are specifying the destination. That destination can be specified absolute path. Absolute path always has to start with slash. This now is specifying absolute path. Each time I am pressing tab now there are multiple ways of completion. So, we will go to 1. These are the various directory already went in the morning. I am just showing that we can go by absolute path also. This is how we can CD. Now we are here. This is indeed the destination we had given. If you had given relative the way of going to that destination still PWD will give us the absolute path. So, this address what the word that was used was address. So, we will we prefer using the word path. Now the destination you can specify as absolute path or relative path. Let us see what all files are here. These are the various files we created in the morning. First thing is in the morning. These are the various directories we created. Now what LS of course does not necessarily need a command. What about CD? What if we give CD new? We will go to new directory. But just CD if we give and we do not give anything. What happened? It did not give an error to which directory did it change to then? You typed CD name of the command and you did not type any destination. So, where did it go? How will we check that? By typing PWD. PWD is like always it is like our GPS. It will always tell us where we are now. Present working directory. It will always give us absolute location. By GPS it will give us latitude and longitude. Think of it like that. It will not tell us your with respect to your home, your 5 kilometers to the right or left, northeast. Not like that. So, notice that when you just type CD you have come to slash home slash belur. It indeed changed the directory. What was the earlier directory? We had gone inside this particular inside another test we had gone after going to this. After going here we went inside another test and then when we typed CD we came to this. So, this is called home. Wherever you are. So, wherever you are you type CD then you have come to home. So, this is one shell variable. Each person I mean belur may not be a directory in your computer. It will not take you to belur directory in yours. In my particular computer login name is belur. That is my name, my surname. That is why the home directory of this terminal is home is slash home slash belur. That particular information is stored inside home variable. So, the home is a shell variable. So, called shell variable. Shell variables we will see in much detail is certainly tomorrow. But right now let us see echo space dollar home. This information is always there with the shell. No matter which directory you have gone when you type just CD then you will go back to home. This information is always contained. Just like I told you before old PWD we had used. This is another shell variable. That information is there. From home belur desktop we had done CD with change directory and come to home. You also present working directory is also perhaps there. If you go to CD desktop, what test files. Now, if you want to go to the previous command on your terminal please use upparoma key. When you use upparoma key you can slowly navigate through all the commands that we had timed in that sequence. How to search through a particular command instead of searching through all of them that also we will see. So, echo home. Home variable still has. It is something you should not touch ideally. All the capital letter variables is something we should not try to manipulate. If you want to introduce your own shell variable use small variable. It is just like when we are doing some mathematical calculation we say let x be equal to 5. We do not mind using different variables for numbers 5 say x sin x. Let f of x be equal to sin of x. But do we say let pi be equal to 3? No, pi is a extremely important variable which always has this particular number 3.14 something some long number. So, like that these capital letter variables, capital letter shell variables are something we should not be touching. I mean unless somebody is really a big batch shell programmer one should ideally not touch this. So, what other shell variables are there? We are still dealing with that question. This is our present working directory. Whatever came out as output is also actually there inside a shell variable. What about? We had gone from our home directory we had come to this directory. So, that is also information in some shell variable. So, does this answer the question about relative paths etcetera. So, there was a question from Don Bosco college Goa T which we had not taken up just before we broke for lunch. So, we will take that now. So, please ask your question now. Yeah, the question yeah we understood the question. If I, let me just repeat the question. If I understand right, you are saying that you created a new file using a VIN editor. Of course, we are very happy about you using the VIN editor, but that is a personal choice. So, what you said that you created a new file using a VIN editor. That is a personal choice. So, what you said is you created a file with a file name starting with dot. Let us say dot doc or dot txt and when you see it using Windows browser using a file browser in Ubuntu, then it is not visible. But then if you go to the terminal and do ls again expectably it is not visible, but you do ls minus a and then it is visible. Of course, to a large extent you have already answered the question. The reason is that you said nothing dot dot txt. If the file name starts with dot it will not be visible for various programs. Even in the folder, in the folder how to make it visible this is something I do not know. At least I am used to the command prompt more and in the command prompt if you want to see the dot files ls minus a is the one to use and we would encourage you to do that. How to create the file instead of touch? This particular person has used the VI editor. We will spend some time on various editors, on various simpler editors and VI is indeed a extremely good editor that some of us here use, but in this course you are encouraged to use any editor. If you ask me my preference I use VI VEM editor. Any other question? Okay, so we will proceed to the next topic which is about MV, CP and these commands with or without the I option. Let us go to, we have a few directories here. So, let us make a file called file 1. Now let us copy this file 1 to file 2. So, copy is a command source destination. So, when you are copying you are supposed to say from what to what, you have to give two arguments. If you do not give two then what it will do of course, good to give this a question, good to ask this question try to answer it. You will see it now. So, if you type like this then it will create a new file. So, first file 1 got created using touch command, file 2 got created, file 1 was copied to file 2. What if we try to copy it again? File 2 already exists the destination. We are trying to copy file 1 now and we are trying to give a destination that is already a file already existing file. Of course, right now these are all empty files because I use touch command there nothing very important there, but more generally you might be working on different versions and you have spent lot of effort all the information is there and you do not want to copy another file as this file and lose the old file and overwrite the old file that is potentially a big problem. At least my settings again tells that it is asking me do you want to overwrite file 2. On your computers you are encouraged to check that it will in general not ask. The default setting is it will not ask, it will just go ahead and overwrite again cruelly. So, in my case it is saying it is asking me if I just press enter it means it will not overwrite say yes sorry. Now, if I say yes then it will overwrite. So, again as expected cp minus i is a one that will really ask us it is an interactive mode. If you want to overwrite without being asked f means force if you want to force the overwrite cp minus f for those of you who might by default have the minus i option yeah you might want to alias it to the minus i option. If you do not want to be asked for a very specific case where plenty of files you are overwriting and you do not want to be asked again again then minus f option will just go ahead array because it is already having that alias it is still asking. Minus f option does not overwrite the interactive option for cp command it turns out as I come to know now whatever move means move file one file three yeah. So, file one was already there file one has got renamed move is as good as renamed yeah move in fact is more is better than that because you can move these files across directories across different different long long paths yeah rename may or may not work move will also move can also move directories so one directly to another place yeah cp also can copy entire directories including sub directories are the additional options that one can give but let us come back to this overwrite possibility yeah. So, now there are these files we just listed what all files are there there are file two file three now what if we try to move file two to file three yeah we are trying to move a file to a destination that is already there again we have there is a potential concern that file three will be lost yeah at least my computer now asks me the default it is in interactive mode he is asking me do I really want to overwrite if I just press enter enter means no it is a safer size conservative since that person has not entered anything let us not overwrite yeah it is like that I say both the files are there suppose we again say yes now indeed file two is not there file two has got overwritten to file three these are the different parts about move you can also move across directories sub directories if you do not want the file name to be different when you let us see what is there inside another there is nothing inside this see there is something in examples yeah inside examples there are plenty of files you can try to make an example directory and make some files just for some test files the fastest way to create some files with a specified file name is using the touch command so in my examples directory here is various directory I am in this particular path what is there in examples these are the various ones suppose I want to copy items dot txt so you all are encouraged to use the tab command for quicker completion it will complete whenever there is no ambiguity suppose I want to copy the items dot txt to the same file here or one thing I can do is item dot txt I can type it here yeah cp is the command of course this is the source that source is not in the current directory but it is inside the examples directory incidentally and from that example directory this items dot txt file copied here in this current directory what file name should it be suppose we do not want to change the file name yeah we are free to choose any file name yeah some new new items somebody stops them from choosing a new file name new items dot txt we can go ahead and copy yeah so new items dot txt has got copied from within the examples directory to the current directory but then very rarely you want to change the file name some different directory to this directory there may not be a requirement to change the file name if you want to give the same file name one option is to actually type items dot txt other option is to say that the default why change one way to do can you go ahead and not specify anything if you do not give any destination it will say look missing destination file operand after examples yeah you have to give a destination now what is a good way where you do not want to specify the name of the file because the file name is the same but still destination has to be provided so that is where dot plays a key role here just say dot dot means what will it overwrite the current directory no file cannot overwrite directory this much basic intelligence linux terminals will have so now it will understand that it should be the same file name in the current directory yeah so if you in the destination if you give something that is already existing some directory name that is already existing then cp command will understand that it should be the same file with same name inside this new directory and for current directory we need the dot so look now when we do ls we see that this items dot txt indeed has got copied from within examples directory into the current directory yeah yeah now how do you copy the same cp examples items to another yeah inside another there are some more directories inside by pressing tab once nothing got completed by pressing the tab key two times it showed us all these completions that were possible because so many completions were possible it did not complete itself it is now showing us those options yeah so one tab key will complete if possible if not possible second tab key will then show you those possible completions now of them you have to choose one yeah so here example now we are copying items dot txt is a file we have to copy from within examples directory we are going to pick it and we are going to now finally put it inside this directory so inside this is directly my poncha denge that dialogue cannot be reproduced in English so spare spare me for this so inside this directory it will copy it why do not we see what is there inside yeah please do one thing and I am typing very fast please use the tab key as well as possible I also have been using this now inside another test then directory inside that particular directory there is only one filename yeah that is why it has in fact completed it that as well as items dot txt has got copied there yeah I think this is straightforward similarly move move also can move a particular file not just copy but actually move it when you move it means at the source that that particular file is no longer there in the source place similarly you can move entire directories from one place to another directory when you move all its files all its sub directories everything will get moved to the destination what about copying directories copying directories I mean lot of move after all no big disk space the same location that much file instead of here it is somewhere else but copy I think is better to be sure that this person really wants so much of copying from here to there yeah how much of a disk space we might have all our files files are larger and larger and we should be concerned about making big big copies of directories so if you want to copy directories with along with sub directories all the files minus r is the option to do it recursively so this is something you can check yourself r for recursive this is an option you have to give only for cp command when you are copying directories from source to destination okay let us come back to this and see what else about moving files copying files removing etc we have been seeing when you are copying as I said r is the option for recursive yeah i i option if you want to be asked interactively whether you really want to remove overwrite or not i for interactive while either while moving it will be overwrite while removing it will ask you whether you really want to remove while copying also the concern is overwrite minus i option works the same way for all these three okay so if there are no questions about this then we can go further into hierarchy linux linux file hierarchy permissions ownership so we already saw that slash is a so-called root directory at this particular place we tried to make a directory earlier this morning and it said permission denied yeah so slash is called the so-called root directory only the root in many linux systems the root is also called the super user su for short super user has the permission for your computer you only might be the super user that is very much possible it is a topmost level of hierarchy think of it like a tree the slash is like the like the like the bottom of the tree from which one by one all branches are coming out and different directories files and all are created if it is a file then you cannot have a subdirectory in that sense it is like a leaf there is something called h i e r higher now but permissions and access control is extremely important especially in the same particular system different people might be using they all might have different different accounts yeah especially in a laboratory setup many people might have different people sharing computers sharing accounts in the same computer inside a LAN setup that is when it is very important at least for the super user to be aware what files should be available accessible to all for an individual it is required that his files are not visible to others perhaps it is required that certain files are visible to others yeah so in a multi user environment it is very important that one should know exactly how to set the permissions access control is extremely important super users have to play have to certainly be careful about this so ls minus l is some option we have been using so far so we already saw the first letter d tells whether it is a directory or a file dash means file that d means directory there are some other letters also that are in general possible so then after that we are now not worrying about the first letter anymore then there are these three letters r w x yeah then another three letters another three letters that is one totally nine letters after the d character so what do these nine characters mean so first three mean something the next three mean again the same thing but for a different person and again the last three mean the same thing for third group of so this user is okay let us see all this in more detail as it says first column shows permission information this entire thing is about permissions first character itself specifies the file whether it is a directory or a file yeah directory files have dashed directories have d so r w x in short stands for read write and execute yeah read is just permission to read write is permission to write execute means can you execute it as a command secondly if it is a directory then the directory has to have execute permission because you have to be able to go into the directory and type other commands so execute permission is very important for directories also not just for commands but for directories also so read and write of course everybody will understand more easily yeah so the first letter as well the first letter is all these letters if the permission is there it will say r read permission is there if the permission is not there there will be a dash yes so let us go back here there is this dash here there is a dash here but there is w here the middle character is write for only the first three but for the next the next two sets of three three characters it is not there so for whom is right there for whom is right not there that is what we will see now so the permissions can be changed not by anybody but by only by the owner of the file who is the owner now where is that information yeah is root is the super user the owner of all the files so that is what we will see now let us go back to this so when we do just ls we see all these files ls minus l will tell us why do not we just see ls minus l of just one file file 3 yeah so for this particular file this first particular name is user yeah it is me the second one is incidentally again belur i should say that is only incident more generally it is a group of people yeah what is group about it for example in our department server there are group faculty members post graduate students undergraduate students these are all different different group why these different groups are important because you see students you might want to categorize into 2009 batch 2010 batch yeah after some after let us say three four years you can remove that entire group all files in one go we do not have to be worried about who has passed out who has not passed out yeah we know that entire batch would have left by then yeah in that sense it is very helpful to form a group but on my this personal computer there is for such personal computers typically the group is the user yeah so now for the file 3 for the name called file 3 the first three first letter of course is a dash means it is not a directory that is why it is a dash the next three letters are what permissions the user has user is belur the next three letters are what permissions others in that group have yeah in this case incidentally the group is belur and the last three are the permissions that all others who have an account in that computer have to this file yeah so that is what the last three letters are so what it says is user has user belur has right permission but nobody else has right permission why because there is a dash there yeah does the user himself have execute permission no there is a dash there in place of x that is a dash yeah for this particular file for files generally there is no execute permission for nobody if it is a command if you have carefully written a command that can execute and do something then you go ahead and give execute permissions to that file so how to change the permissions how to change the mode so this is called mode yeah all this information is called mode that information is changed using the ch mode command let us go back to this particular file change mode command is to be used minus r is for recursive option if you want to change all the you want to give right permission to plenty of files inside directories sub directories all in one go then minus r is option as I said r is for recursive either capital R or small r when the when there are two important words starting with r then one will be capital one will be small typically yeah so how do you change the permission of this particular file for example this is how one can do it this is the first simple way to learn it change mode only the user can type this other side try to type this you say you are not the user you are not the owner of this file you you for user g for group plus meaning you want to add permission to this x add what permission execute permission to this file yeah this is extremely important thing this is one of the most difficult commands amongst all the commands we have seen so far move ct ls touch file rm this is the most complicated due for user g for group plus for whether that execute permission has to be given now or denied yeah x for give and x what permission are you talking about are you plan to give read permission or write permission execute permission we are speaking about execute permission x for execute to foo.sh so why don't we try these permissions to the particular file we saw yeah so okay it is a good idea to see this also you for user g for group o for all other o for other meaning outside the group a is for all in one go everybody just goes ahead and gets up right includes the user plus for adding the specific permission minus for removing equal to means yes you specify what mode it is supposed to be in then you have to finally specify whether this addition or denial of these permissions are for what read write or etc these are the three information we have to give let us go back to this terminal let us see in detail the permissions for file three yeah it says that the user has read and write permission but the user doesn't have execute permission others in the group have read permission others in the group don't have write and execute permission everybody else who has an account in his computer outside this group possibly have read permission but they don't have write and execute permission why don't we change it can we change it yeah because we are the user how do we know yeah we are the user another very important command that is not the other slides called who am I yeah if somebody has left that computer on and gone off and you come on this computer and see you see you want to know who is this idiot who has logged in and gone who is logged in forgot to log out and gone yeah you want to see the name of the idiot unfortunately until the that time you have to say who am I yeah computer will tell you that belur person has logged in yeah so who am I belur so since the person belur has logged in here here there is belur that means that the owner of that file is belur certainly ch mode command when you execute it will not mind it will not give an error change mode you want to give let's say to everybody in the group let's say to all we want to give the permission in the add the permission write yeah of which file file 3 so it appears like we have it has not complained we have given this particular command it has executed let us see whether the permission have indeed been given or not yeah so it turns it seems to have given what about execute permission why do not we give execute permission yeah it has gone ahead and given execute permission to all read and write were already there yeah it seems like everybody has been given all permissions to this file does this dash mean that some particular permission yet to be given does this dash mean that some permission has not yet been given earlier see there was this dash here that dash meant execute permission was not given to the user but what about this dash which permission yet to be given yeah this dash person here says this dash doesn't mean some permission has not been given that dash anyway supposed to say whether it's a directory or a file this dash does not signify lack of some permission yeah please note every dash need not mean lack of some permission it means it is this first character is supposed to be either directory or not yeah there are some other s letters which are very hard to understand for me but some general other letters also that are possible there but dash means file the most common so notice that because you have given permit execute permission now suddenly your terminal has given some different color rather smartly yeah it things are now it is a command to be executed if it were a directory different color file non executable file one color black an executable file another permission yeah so this completes about changing the mode you can see help ch mode there are better shortcuts using some numbers using binary descriptions by which we can specify without all this u g w x plus minus without all that there is a faster way to directly specify the mode of a file using some numbers between 0 to 7 what about h own you are not the owner what to do then yeah with this particular command is relevant for relevant for super users generally for roots yeah if you copy a file for somebody's directory you want that person to go ahead and modify and change permissions change mode so the person should be the owner eventually then whoever is the owner should go ahead and make this other new person the owner that is when ch own is important in my opinion it is not relevant for this particular course nor is it relevant for today tomorrow in any case so ch own changes the owner and the group you can change both owner and group change group can also be done by some other command ch group I think but this is not relevant for this course so by default the user whoever is logged in whoever creates a file is the owner you can change yeah you can change the owner by this particular way the root root can certainly change the owner okay so let us just now start opening all these empty files we have created let's open the PDF files we have created before we go to this important topic can just take up some questions are there any questions so far about file hierarchy basic final handling all the topics we have covered so far how to create users and groups is a question that somebody has asked so that is very relevant for for a super user yeah so uh since somebody has asked us we can spend a few minutes on that question any other question if there are no other questions we will spend time on how to create users and groups are there any other questions this is a good time to ask yeah we are connected to Srinagar please ask your question so my question is normally if we execute a copy command it will create a new file with new timestamp so is there an option in copy yeah is the same question yeah is there an option in copy command so that we actually preserve the old timestamp yeah yeah yeah this is a extremely useful very important question so if you so his question is when we copy a old file suppose there is some file one month ago you modified it now you want to copy it at another place and you want to he has already noted he's already checked and notice that when you copy a one month old file now then suddenly it becomes as if you created it now as if you modified it now yeah and these timestamps are important yeah for example we write some code then we detect some change somebody discuss then we want to know whether this is a code after discussion or before discussion maybe we are not following good version control practices whereas because we all have not done this course already at the end of this course maybe you will not have this problem because you will be following good version control practices so how do you copy by retaining the timestamp of the source file this is the question he has asked which I am sure is possible just that I don't know now but Harish here has been smiling saying it is possible so maybe I can ask him to come and quickly answer this doubt yeah so somebody in Srinagar has asked somebody else has asked what was the question in Srinagar center so question I will repeat again the question is how do you copy by keeping the timestamp of the source file CP has a option called preserve attribute basically if you use that it not only preserves the modification time it preserves the owner the original owner that the file had and the timestamp data all those metadata's are essentially as is unchanged and copied to the destination folder CP CP-p it is very useful for you know doing backups copying make projects and all that yeah that answers the question about how to copy by keeping the attribute by preserving the attribute so P for preserve we will go to Rajakmi engineering college so please ask you question now my question is in the command apropos can we use two keywords to find the appropriate command so the question from Perrier Institute was that in the command apropos can we give two keywords can we give two keywords and get everything together so that question is useful let me just quickly check I also do not know we did apropos remove and remove and timestamp so whether these two words both have to be there or at least one of them has to be there is the concern so it has given any if either this or that is there then it has given those it is a union of the two things if you had apropos remove then some command would have come out if you had done apropos time timestamp then these other would have come out these others have clearly nothing to do with remove but it is giving both now yeah so or operation seems to have taken place between the two words I believe that answers the question apropos there was another question about on chat about what are some numbers that come in by what is yeah those numbers what what they mean would be there inside man what is yeah that is why we prefer not taking up that question we will meanwhile go to another question from Rajdekshmi Engineering College can you give the example of the equal operator say get smooth sir change mode so we heard your question the question was that in CH mode there is a plus minus that we said plus is for adding some permission minus is for denying some permission it appeared like equal to is for setting the permission directly whether or not that permission was there perhaps that is what it means but then I am not check this and I strongly encourage all of you to check this and discuss this on Moodle because this particular fact is not urgent as far as today's and tomorrow's is concerned I will also check meanwhile yeah so on chat there is a particular question about how touch command can be used to create a empty file but cat command can also be used to create a new file with some more meaningful content yeah that is indeed correct and we will see this in more detail somebody else has said what is the difference between CH mode 777 and giving all the permissions yeah so this is indeed correct there is no difference so CH mode 777 by using these three numbers everything that is possible by plus minus u g o a x so please use small x yeah I see that you have given use capital X capital X may or may not work I do not know but small x is the recommended way so if you use this in three numbers that is also fine they are the same they are equally equally helpful we will go to the next topic about looking at file so somebody already asked cat yeah cat is indeed a good way to check what is there inside a file so what does this say cat cat for displaying the contents of a file cat file one will display all the information onto the screen by default yeah if you put multiple things it will also show all the content one after another in this sequence first it will show this on the screen then it will show this on the screen in that sense it can be very helpful for concatenating various files yeah you show them one after another and just take all the output into one that is the cat is for concatenate actually it can also be used for seeing a file one of the questions is can we change the default permission given to the directory or file yeah when we create a file can we change the default permission so there is there is some such setting so I have digressed out of cat command to a question that has been asked on chat the question is can we change the default permission given to the directory or files yeah so this is very much possible in Unix or Linux that every user you can whenever you create a file it will never have read permissions for others yeah that is potentially unsafe to have read permission to others so this can also be made as a default setting that requires some particular command I think starting from you somebody knows this starting from you there is some letter there is some command by which you can make the default permissions to any new file that is created yeah we will check this and let you know on on the forum but this is certainly possible it is just that I do not remember now coming back to cat command so cat is a command that will spit out all the contents of the file you mask somebody else has typed you mask yeah this is exactly the command to use if you want to create a new file with specified default permissions yeah thank you very much mjeth 34 mophaka college hydropath we have an answer you mask is a command yeah it is many years since I heard of this command yeah okay thank you very much so we will go to the cat command so cat as I said is for showing all the contents onto the screen all in one go everything will come on the screen perhaps it is too much per there might be much more than one screen full that is when cat is not convenient that is when less is extremely useful for seeing the contents of a file what is the significance of less it will show it on the screen but one screen full at a time yeah then you can press space bar and see another screen full you can go on doing this you can press q for quitting and coming back to the prompt so q for quit arrows up down for navigating inside this file which are opened using using less you can use ng to directly jump to a particular line inside less very importantly you can use search for a pattern yeah you can press slash command and then look for a particular pattern so there is some there is a whole lot of there is a whole lot of techniques for looking for certain regular expressions like whether some particular word occurs at the end of the line whether this particular word occurs at the beginning of the line whether some pattern occurs at the beginning of a word yeah so that those are all called regular expressions and this is something very systematically taught in computer science but we all need to know a little about regular expressions and we see that in more detail yeah but inside inside less you can use h for help slash pattern is what you can use so please note all this is relevant only for plain text files yeah so we are going to spend a lot of time on manipulation of just plain text files precisely because we have all these tools handy we have cut paste etc so you will not be able to use less command on a pdf file if some file is a pdf file and you know some particular word occurs there less is not the command to you nor should you use cat all the contents will come on the screen and maybe even the terminal will get spoiled terminal meaning the actual monitor hardware will not get spoiled but you might have to exit that term exit that shell and start again in any case some junk characters is what will come because pdf files are in general binary files so we have a question from Amal Jyoti college Kerala we will quickly see that before we continue with less suppose if I am creating a file how a group is assigned to that file so like that file may be belonging to a group now see we have understood the question yeah I thought I indeed told that I will discuss about this so yeah let us spend some quick time discussing about this yeah so we will discuss from Amal Jyoti college Kerala because let me repeat the question the question is when we create a new file how is the user group everybody decided for the file yeah so as I said this is of primary concern for super users be as individual Linux users do not have to worry about this yeah on this particular computer for example I am a primary user sometimes my wife also uses it you might have different different settings because of which she is also a different user on this just separate login account on this now why don't we go and see what what what files are there in her account yeah CD let's go back here here CD CD means gone to my home we go CD back so here are three other users totally three users one is me one is Fossey yeah Fossey is another login on this one is Sharbani yeah so let's go to Fossey so here all these directories are created you can do LS minus L yeah so here it says Fossey is the user of this directory called desktop yeah what's the group Fossey on this computer when that new user was added called Fossey that time the separate group was not specified yeah how was the new how was the user added from the command line one can add user add user yeah yeah so from the command line you can type add user yeah maybe it will ask super add users yeah it says only root or group can do it only only root may add a user or group to the system so right now I am logged in as Belour first of all then I have gone into somebody else's account some user called Fossey and there I am trying to add a user yeah so clearly this add user group user these are all most relevant for the super user super user means what on each computer if there are multiple users then it is relevant so that is the reason that we didn't spend too much time on this it is not relevant for all users at least today tomorrow we want to learn how to use Linux tools as an individual first yeah then the super user then we all become super users for some computers where multiple people are going to come and we as a super user should know that different people have different privacies so just as an example let us see now that we will try to remove RM minus RF desktop yeah it says cannot remove desktop permission denied why is that who am I Belour yeah Belour is the person logged in let us see LS desktop but LS minus L will show us that desktop is actually this Fossey login Fossey is the owner of this only Fossey user can go ahead and remove this desktop directory yeah others cannot do this and quite understandably at least execute permission has been has been given to this directory that is why some other user could come in here and see all this yeah now that person is trying to remove it also but but notice that desktop directory yeah has read permission read permission of course it has read permission for everybody in the Fossey group it also has read permission for all others I Belour belongs to others yeah so it will allow me to go to desktop this read permission is not enough execute permission for the directory is also required if one has to be able to go to the directory yeah here one can see of course incidentally there is nothing inside this yeah so this much is all that is relevant one can go to another person's directory if you have an account in that computer you first login into the computer then you can navigate back side to the parent directory from your home and you can see who else is there you can go to the directory if the execute permission for their directory has been given by them by that owner yeah that who created that owner the super user for the computer that super user when creating would assign some groups but all this group assignment user owner you mask all this is relevant only for a super user of a computer where multiple users are logging in yeah so for today and tomorrow we want to first get used to how to use before become before we become super user on a computer why do not we learn Linux tools for as an individual of our computer yeah that is the reason we do not want to pursue further from here so let us go back to the slides we were we had started seeing the less command less command we already saw we can look for a pattern we will start seeing this we will see some some more hands-on of this on the terminal meanwhile there is a question from Amal Jyoti college Kerala so yeah please ask your question you are connected I have one question regarding ch mode that is changing of permission I want to know what is the syntax for copying one users that is one class permission to another class to copy the permissions of one class exactly to another class like user to other yeah thanks for your question her question is when you copy one file from somewhere to somewhere else we do not want to know again set from scratch the permission exactly as it was in the source yeah we will like that the permissions of this new created file are inheriting exactly from the source that is her question as far as my understanding is concerned to the best of my knowledge the permissions are copied by default yeah or maybe the permissions come from the directory so let us let us take an example let us take an example to see this to see how it is working so some default permission how they should come might this information might be there in ch mode help ch mode but let us see an example yeah so we are we are back to this terminal we are in this particular directory it will not help to make a directory here yeah why because that particular desktop is in somebody else's login yeah so we are where are we we are in this user foxy user on this computer but I am not foxy I am not logged in as foxy yeah and logged in as belur so what to do now let us go back let us look at the file of examples yeah this is just a file with read permission here yeah sorry look at this particular file called examples dot desktop it has these permissions at least read permissions are given why do not they copy examples to belur example yeah what is your guess will this work or not will this will this when I press enter will this command execute successfully or not yeah cannot create regular file permission denied who has denied the permission foxy user has denied the permission for others to write a file in the home directory of foxy yeah permission denied write permission let us ls minus al just for a minute let me make this small so let me just ls minus al rt rt are some additional options so that they get they are sorted according to the time stamp yeah r for reverse time stamp the most recent most modified will come at the bottom yeah so you see dot the current directory where we are in this is this has been given no write permission for others in the group no write permission for others hence belur cannot log in here cannot navigate and come here and create a file here yeah quite expected now why do not we try to copy this particular file not in the same yeah we will copy it one backside then there are these three we had already seen this is my own yeah here is where I can certainly create successfully why do not we copy we didn't specify the file name we ended with slash means same file name yeah it it turns out that there is already one file it asking me yeah why don't I say just yes so let us go ahead and see so there is an examples dot yeah and same permission has been given there yeah it it turns out incidentally the same permission has been given is there some default thing or what yeah is there some default default I think the permissions are inherited to the west of my understanding yeah even if sometimes of course I should say permissions are also inherited from the directory if the directory has been has been giving read permissions to everybody then any file you copy there will also be given read permission this is very relevant for web pages yeah you might copy a file from some other directory into your web directory whatever files you have kept for others to view on the internet then automatically they are better have read permission unless you explicitly remove the read permission they will have read permission for others yeah so beyond that we don't want to spend time on ch mode if everybody knows ch mode how to change the mode for a specific file that's enough how to set the defaults you must luckily somebody has answered that question any other question of inheriting etc we don't need to take in the class okay so we will see a little more hands-on of cat and less so cat items so when we do cat items dot txt it has shown all of this onto the screen yeah luckily it was only one screen full let us see new item we can also cat two things together items new items both it has shown one after another both in one go it has not even bothered to say that at this is where the new file is beginning yeah it is just shown all of it in one go very helpful for concatenating yeah you can concatenate plenty of text files one after another if some file is really big you can split it into separate files take it as smaller files for example when sending an email if the file is too big you can split it send it as a person to concatenate it using the cat command so now we can also see less less items yeah now it has shown a screen full but after showing it has not come back to the command prompt yeah it has ended here it is saying end because there's only one screen full yeah so why don't I create a bigger file don't worry about what I am typing now we will explain what is the meaning of all this greater than signed tomorrow why don't we see this bigger there's a big list a bigger file slightly bigger actually it's just the double of the previous file programming pearls is the first line programming pearls is the first line of that items dot txt programming pearls is again occurring here yeah in fact some same few words same few characters repeated again again yeah but inside this we can look for the word unix yeah it has shown all of this we can look for language yeah lang l a n g character appears inside language so it will show all of these and and also highlight them we can do n for next next yeah if you want to go to the previous occurrence capital n we search for a search search is the one of the most frequently things frequent things we have to do inside a file on google for example we are all regularly searching various things google has to have good algorithms for searching searching then searching and replacing these are the most frequently used commands inside a when we are looking through a file so in how do you do it in less in less press the slash key immediately your cursor has gone to the bottom waiting for you to type the pattern yeah you can r a m m m i it will show all the places where ramy has occurred yeah ramy has come in programming yeah in fact programming is the only place where it has come and and luckily there are many in the same in the same file in the same screen full they are all being highlighted when you press n the next one comes to the top of the line yeah he is the same pattern will come to the top of the screen full that we are seeing yeah we can go to this is the last pattern being shown further it says pattern not found if you press n again again if you want to go to the previous pattern capital N is where it is going to the previous pattern previous pattern etc if you want to search yeah inside some very big file let's say of having thousand lines if you want to you might want to search separately front and back search forward search backward might be separate slash is for searching forward yeah question mark is for searching backside yeah in this small file it doesn't matter but for big files it certainly matters so s is one can ask is this less case sensitive or not yeah why don't we search for so it is case sensitive yeah if you want less to be insensitive then there are some options you can also yeah you can see h and see what are the various options and surely case sensitive case insensitive insensitive is certainly going to be there yeah so please we encourage you to use h and help if you want to always start less if you want whenever you use less if you want it to be case insensitive yeah we don't want to be typing capital small separately each time we don't want to each time set the current less to case instant insensitive mode suppose we don't want to do that each time it is possible to default set it in insensitive mode these all options are certainly there and less is one something we strongly encourage you to use much as far as possible for searching various things please use less we also wanted to see cat yeah so cat is when is relevant when it is just one screen full cat bigger has just shown everything on the screen importantly it has come back to the prompt which was not happening in less less of a file was showing it to you and waiting for you to press q yeah why because you might want to do various things you might want to search etc so it is not going to come back to the prompt until you press q so please remember how to quit out of less q is the letter to type okay what about word count so often in a file we want to know how many times some particular word occurs so word count w c is the command for statistical information about the file it will give you three things number of lines in the file number of words in the file and number of characters number of characters is extremely important especially now there are so many websites from which you can send sms where there is a word count yeah there is some small box text box where you have to type the word count where you type the characters if you want to pre-define the file in your editor and then copy paste it there so we want to know in a file how to check the word count yeah so that is what you will use w c for we before we go to the terminal let us see what else is there in the next slide head tail cut yeah cut of course the most important thing let us see word count then we will say head and tail w c bigger it gives us three integers the number of lines number of words number of total number of characters yeah computer science people please do not ask us whether new line character is counted as a character or not yeah it is best to try this oneself take one big take one file with empty many empty lines many lines on each line only no character on each line I can test this whether the number of lines are being counted or not in the character count you can also let us see for items that is why we please note that this bigger dot txt was just was constructed from items dot txt by putting it two times one after another so of course each one of that is double of this yeah so now if you want to if you think that some important information is only in the last line or only in the first line yeah for example what we had been doing when when we are so head head and tail commands are extremely important many of our exercises require you to know head tail well we will do head and tail in more detail after we stop for t thank you