 So, this here if you want to remove all these spaces, then instead of just echoing the dollar we can do this, we can remove this particular space, as I said, TR is the one that we use for translating one character to another. So, TR minus S, S was suppressed, suppressed meaning what? Multiple occurrences of the space will all be replaced with one dash only. So, it will replace, then it will also cut the dash with, then it will separate them to separate columns. So, exactly how this works is best seen when you write this into a shell script and execute it and see. For this particular thing to work, please touch, use a touch command and create some MP3 files, create some MP3 files with the space inside the file name. This is what you will do after some time, just a minute. So, whatever is to be done is very straightforwardly explained inside the slide. So, we request you to try this a little later. Why are we doing this? There are a whole lot of things that have to be tried oneself and be convinced about our test today requires you to try it. Yeah, please let me point out to you today only we have a test later today at 5. We might consider preponing it, advancing it a little exact time we will tell you. In any case, it is either from 5 to 540 or before that only. But then please try out all this, whatever is to be tried requires you to type all this in your editor, in the nano editor or G edit. In any case, save it to a file and execute it. But you can do this together in one go after and then we can answer all the doubts. So, meanwhile we can start looking at the while loop. So, for is for a fixed number of entries for every element in that list, how about while? While as long as some condition is satisfied or not satisfied, as long as that condition is satisfied, we will keep doing something. This also whatever is to be done is again put between 2, between do and done. So, read, read is how you read a variable from the keyboard. And as long as that person who is typing in the keyboard does not type quit, as long as that person does not type quit, it will keep saying this is the input, this is the input, this is the input. When quit is typed, it will say input equal to quit and it will quit because the condition for this while loop exiting has been met. This is what we can try quickly. So, please open your editors, nano, nano, while, x. So, my path has already got modified. So, here is our nano editor and we are going to type everything that is on the screen. I request everybody to type there at each place while. So, here we have disabled all colors. So, better to do a little indenting. Here you have the option of indenting for better readability in Python that will get removed. Then you know option, you have to indent test 1, test 2. It is not quitting. To read done input equal to where, read variable dollar where, so I forgot this dollar. So, you all please type whatever is there on the screen. So, I have written this. The first time I tried this, I had forgotten to put a dollar here because of which whatever variable was being typed in, it was not getting substituted here. Only where itself was coming there. It was not comparing with quit at all. Each time only where was getting compared with quit, not the value of the variable where. So, exit 0 is some syntax. That is important when you are exiting some while loop, you want to keep track whether we have exited gracefully or not. Some exiting gracefully is an important part of Linux scripts. So, if you do while, then it will say which enter 1 by 1 test, different things we are typing. If we type capital it will not, when we type quit, then it will come out. So, this is just simple execution of the whatever is written there. So, what you can do? You can do dot space while. You can execute the same shell script using source using dot and please do this later because it will exit from the terminal. That is what I found out just now. We will go to the next slide. So, those of you who have not yet finished trying this can try this later. Somebody has asked on chat how to comment block code in .sh. So, if you open an editor, that is when you can comment various things. You can do lot of modification. Cut, paste, cut, paste, copy, grab. These are all from the command prompt. If you open an editor, there are many more things one can do quite understandably. Editor means what? You can modify everything in the file, delete everything. Any text that we are supposed to include, we have to write. All that is going to be written using a editor, text editor only. Nano is one example. Tico used to be another. There is Vim, just Vi. G edit is what we told you. There are plain Emacs is another editor. Extremely widely used also. Most of us here prefer using Vim because it is extremely powerful, but it is finally only editor. Once you edit all this and send that information to somebody else, they can edit that file using their favorite editor. This is an important significance compared to doc file for example. You send somebody a doc file, that person is forced to open using a very specific package, either Microsoft Word or using open office. But plain text, if the information is just plain text, it does not have any formatting, then you just send the plain text. The other person can grep through that particular file, looking for a particular pattern. The other person can cut, copy, paste, different columns. That person can also open the same file in any editor. It can also be copy pasted directly into a browser in a form file. There are various things one can do with just a plain text file. If you want to now edit it, then you can open it in your favorite editor. Now, for example, to answer this question, how to comment block code in .sh file? If there are many lines you want to comment all of them in one go, then you open it in an editor and different editors have different ways of adding a comment at the beginning. This is extremely easy in VI, but then if you use a complicated complex editor, then these tasks will become even easier. But this complicated editors will also require you to spend more time learning it. So, in Pico, I guess it is not possible that you just mark everything in one go, you put a comment. Perhaps in GID it is possible because there is a mouse etc. In when it is certainly possible? So, how to block comment depends on the editor. That is the purpose of this discussion. And different editors will have different ease, different levels of difficulty of performing this particular task. The next thing to discuss is environment variables. So, somebody is asked, there is no multiple line comment like in C C plus plus. This multiple line comment like C C plus plus is not C C plus plus property. You are opening it in some editor perhaps built in into turbo C or bolland C. That is allowing you to do this. The editor is providing you this property. So, maybe it means, yeah. So, now it is now that I understand this question. Is there no multiple line comment like in C and C plus plus? In C C plus plus, you can one whole set of ten lines at the beginning of the first of these. Suppose, there are some ten lines you want to comment out altogether. Then at the first line of this, first of these lines you put some particular character. At the end of the tenth line, you put another character. Everything that is between these two special types of symbols, everything is going to be considered as comment. But then that is not how C C C plus plus are where you write these programs and you compile it and then make some object file or something. But in bash line by line it will already edit it. Line by line it will execute it, except for while etcetera where it from do up to done it will all understand in one go. Here in bash scripts line by line it will read. Because it will read line by line, there is no multiple line comment in this. Each line you put a hash in the start or anywhere in middle of the line you put a hash, everything on that line after that hash is considered as comment. To the best of my understanding that is how it is. One uses hash for each line. For multiple lines, if we know there is one, as in when we know it, we will put it on modal. Thank you for this question. And I am sorry I did not understand the question first. So, if you want to comment out 10 lines in one go, then you have to put a hash at the beginning of each line. How to put a hash at the beginning of each line? There are multiple ways. There is TR for example. But if the editor allows then you can choose those 10 lines and do this. In WEM it is easy. We will spend a few minutes on that. But there is no block comment like it is there in CNC plus plus. So, the next topic is how to check all the environment variables that are there in our bash shell. In our shell, there are many variables. We saw old PWD, we saw home, path. How about what are all available? There is something that was asked. So, as it says here, let us just quickly see this environment variable slide. So, pass information from shell to program running in the shell. In a particular shell, those shell variables are available for programs that are run inside that shell. Another terminal those variables are not accessible here. The behavioural program can very much depend on the variables, on the values of the variables. So, shell variables, environment variables. This is just some distinction for convenience. Environment variables are the ones that are already there like home, old PWD. These are all typically capital uppercase for convention. This is only a convention. If you give me an example of a variable ask is this environment variable or shell variable? There is no big distinction. The way bash scripts work, they both will have the same effect. But it is recommended that environment variables is what bash will automatically modify. Any variables you are introducing, do not choose capital letters because that is likely to already be there and you are interfering with bash working. For example, path, because while I was showing you I modified path that particular terminal stopped working and I had to exit out of that and start a new one. So, capital ones are better untouched. For your own purpose if you require a shell variable, use small letters. Shell variables only current instance of the shell. Environment variables will be also initialized each time you start a shell. Those will also be available. They are available only for usage. Do not modify them. You can see echo OS type. It will show you the operating system type. Home of course we already saw. Folline command shows values of all the environment variables. Print n. Print n I just not tried. You can also try. All the shell variables that are there in that particular terminal capital small and their values all are shown in one go. This way you can pipe it to less. What ENV does? You can try this. Export. For certain environment variables you should be exporting it. You can also export it while you are defining it. Export path equal to this. Instead of defining it in one and then exporting the path variable in the next. When you are exporting the path that time you do not need dollar here. You do not need dollar either when defining it. When you are defining it on the right hand side you need because you want the value of the variable path. But on the left hand side of this equal to you do should not be putting the dollar. Also when exporting should not be putting. That is why the two can be combined. Miscellaneous tools. So we have reached a stage of miscellaneous tools. So it is a good time to ask questions. This is a good time for all of you to ask questions. So one of the question we have received all of you please one by one use the hand raise option on your ABU and ask the question. Meanwhile we will answer this question about how to print the tenth line of any file using grep. This is what we saw for a very short while yesterday. But we had not seen grep. So why do not we see that in more detail now. So the question is, the question that has been asked on chat is how to print only the tenth line of some particular file using grep. So suppose can't password. Suppose this happens to be line 1, 2, 3, 6 line. Suppose this is the sixth line and we are interested in seeing only the sixth line fully. As I said you can actually open an editor and delete all the first five lines and all the lines after the sixth line in one go. In VI this will be really easy. But if you know that you are interested only in the sixth line for sure. If you know that, do you have to open an editor? If you are interested in just extracting out some information and you know precisely where it lies. Do you have to open an editor? Editor opening we will always prefer not doing. If you are not really interested in modifying that file. If you want to just get some information out, then you use one of the skirt, copy, paste. These are all extremely efficient. Especially when you are dealing with a file which has less than thousand lines, ten thousand lines, hundred thousand, any number Linux can open. But then to open it in an editor will take lot of time whether that editor is Microsoft or Linux. It will take little more time simply because so many lines have to be taken into this memory. It has to be displayed page by page. Line numbers have to be calculated. So, for that purpose if you know with particular line you want to extract out, if you know it precisely best is to do it from the command prompt. And so much can be done from the command prompt. With the editor you can do much more of course, you can modify it. But then that is not suitable if you have a really big file. That is not suitable in any operating system. We are not trying to say Microsoft is particularly bad or Linux is particularly bad. It will take more time. But from the command prompt all these very powerful tools can help you do so much without even opening an editor. If you open an editor with WEM, for example, you can do even more, far more complex things much faster. But then you have to open the editor at least. So, coming back to this question of how to extract out only the 6th line or only the 10th line or only the 6th, 10th and 12th lines, only these three lines for example. This is what we had started asking yesterday. But for multiple lines we did not do. So, let us do let us say 6th and 10th line. 6th line is games, 10th line is mail. 6th and 10th. 6th, 10th and let us say 12th. So, first thing we will do is we will grep for, I am telling you one way with SED with a streamline editor like SED you can do much more easily. But once you learn SED you can do so many other things. You have to spend some time to learn SED. That is not part of this course. So, why do not we do? Look at all the lines which have the begin line character. Obviously every line will come. Every line will have a begin line character. Every line will also have a end line character. There is no surprises. All lines have this end line character. Now we will like to either begin line or end line you can take. Take any character that is guaranteed to be there on every line. And now we want to output line numbers also. Minus n option in grep will print the line numbers also. It has printed all the line numbers. Now this particular thing we will pipe to again grep. Now you put, if there are multiple lines then you have to put minus e. Which line you want? Somebody wanted 6th line. Here it is. Somebody wanted 10th line. Somebody else wanted 12th line. So, this is 10th line. So, you see now this 10 has come even though it does not occur at the beginning of the line. We want a 10th line. So, why do not we now say this, after these lines have been introduced it should be the first character. This hat does not mean 10 occurs in the beginning of the original line. It means it occurs, 10 occurs in the beginning of the line that is inputted to the grep command here. And that one was output of this grep command. This grep command conveniently put the number at the beginning of the line. And hence if you put the hat symbol here then it will put precisely those. Of course, it will also print 60th line but that we know how to disable that. So, now it has put precisely 6, 10 and 12. If you wanted the first line also 1, 1 will occur everywhere in the file in that line to begin. Now, we do not want 1, 1, 1, 2, 1, 3. We want colon to be there after this. That is when only first line will get picked. So, these are the different ways in which you can get out only specific lines. But look, this is not how the file was. The file first line was only from here. This 1 colon got introduced because of this part. This minus n is printing the line number. How do we remove this again? We can use cut. We can pipe the output of this to cut. What delimiter? Colon delimiter. File name do we have to specify? No, cut requires only one file argument and that information is being piped to cut. Now, we have to still specify which fields from 2 onwards. So, this is showing you precisely the 6, 10th, 12th and first line and it has removed the first column. Everything that occurs before the first colon has been removed. Significance of this is, of course, if you open this particular password file in an editor, you can go to first line, keep the first line, remove the second, third, fourth, fifth, keep the six. You can of course, remove this. It is really easy in any editor. But that particular file might have 1000 lines. And if you know already before and that these are the only lines you need from the command prompt itself, you can get precisely this line. The significance of using all this crap, grab, cut, paste is from the command prompt you can do this. If you open this file in gedit for example, you can use your mouse, copy the part that you do not want and remove it. That is not at all hard. Somebody might say when you can do this in editor, why do it here? Here you can do this from the command prompt. You can automate this. Suppose you have 100 files, all the 100 files you want to remove, you want to keep only the 6th, 10th and 12th and first lines. Suppose you want to keep only these four lines for 100 files. Are we going to open 100 files one by one and do the same editing operation? Are we going to copy like this? If we do for 100, we will first of all, we might go crazy before that and we are bound to make mistakes. And with one command, you can write this into a script and execute this on all the 100 files using the for loop. So, the purpose of teaching this course to all the science and engineering students is that all the students across India are spending so much time for repeated use and with the command line interface with the prompt, one can perform all these objectives extremely easily without even opening an editor. If you open editor, of course you can do many more things but for a routine task, do not open an editor. That is a simple policy we are trying to convey. Any more questions? So, how to remove a specific few lines is what we have already covered. How to do this for 100 files is something you can easily do by combining this, writing this into a script using the for loop. How to, if each file happens to have 10,000 lines, then any editor will have a lot of time opening it, whether it is Linux or Unix or Mac or Windows. So, please use command line interfaces as easy as this. If you are working in Windows, all these files require this editing, you do not have to go to Linux. Even in Windows, there is something called SIGWIN, C Y G W I N, which will help you do all this. All command line, just like Linux, all command line interfaces available in SIGWIN from within Windows. We will take the next question from Jaipur College in, from Jaipur. Sir, as it is mentioned in the slide number 60, you can directly run your SH files on the prompt without giving your name. That is only the character dot and slash. How could we do that? It is slide number 60. Sir, multiple line commands in GED IT editor. One more sir, it is multiple line commands in GED IT editor or some more other editor, like nano editor. As we give the single line command using the hash that will be converted as a single line command. You are told there are the number of text editors. You could do that using that. How could we do that in nano editor or some other editor? Thank you for your two questions. So, the two questions from Jaipur were that on slide number 60 that we are seeing now, it says it can be run without dot slash. That is one question. The other question is how to do multiple line commenting in any other editor? That is the next question. So, the purpose of this particular slide was about the path. If you, if you, if this results dot SH happens to be in one of the directories that are listed in path. If it happens to be there, then you do not have to say it is in this current directory or where it is. Absolute path we had to give, absolute no, we had to give the path. We had to say for catting dot SH, we had to say that it is dot slash catting dot SH. We had to say that because the current directory was not in the path. If you include the current directory in the path or you go ahead and keep the catting dot SH in some directory which is already there in the path, then you do not have to type the entire path. You just type the file name. It will get found in one of those directories. It will get found in only those directories which are there in the path. So, it says put results dot SH in one of these locations. Which locations? You do a co-path and there are many directories that are coming out on the screen. Whatever comes out on the screen, in any one of those directories you put results dot SH, you might require root permission to do this. Yeah, because your, most of these are some slash users, slash bin, etcetera, you may not have root permission there. But if your own home bin is there, then you can put it there without any root permission. Then you do not have to specify this. That is the purpose of this particular slide there. But I said that some permissions are required. You cannot go ahead and try to keep any file in dot bin slash bin directory. That only the root can do. What you can do? You include some directory inside your home and there you keep whatever file you want. That as the owner of the directory, you can write whatever files you want. That will get found. If you include that in the path, those files will get found. Another question was how do you do this block commenting in various editors? Yeah, so that requires some discussion. So, when we start studying some editors other than just nano, nano is an extremely simple editor. Even as simple as nano is this G edit. That is how we read it. G edit editor is also very simple. That is how we recommend those. But I will show you how it is very easy to do these routine things in the VI editor, in the VIN editor. VI stands for visual. At a time when VI editor was made, that is more than 30 odd years ago. So, that was 30, 40 years ago. There was only the VI editor. That was the first visual editor. But even now it is extremely widely used because of its power. At least I am really a fan of VI editor. So, that is why we will spend 5 minutes on this. Otherwise that is not there in the syllabus. So, the next topic is resilience tools, find. This was one of the questions I think yesterday. Find all the, how do you list out all the files, directories, sub directories, all of them in one go. So, find files in a directory hierarchy, offers a very complex feature set. You can do lots of complicated things in using find. So, we recommend that for detailed information of any command, please use the man page. That is the right thing to do. While we are available here for help, we may not be able to answer your doubt as quickly as possible. The man immediately information will get, that is at least while this course is running. Later on you are all on your own. You all should be able to answer your own queries. Please use man. Much of the information is there. Some really advanced thing is what is not on man. That is what there are many user groups. Linux you will be surprised. Any doubt you have just put it on Google and somebody has already answered elaborately. So, now for example, if you want to find all the PDF files in this directory, sub directories, everything in one go, all those things you can do using find. So, let us see this find. Where are we now? Find dot has given lots of, why do not we pipe it to less and see them one by one. It is listing all the files inside this directory, files and directories in this directory. That is because the sub directories did not have any files anyway. Why do not we go to, here there are quite a few and we will again run find and pipe it to less. Why are we piping it to less? Because you want to see one screen full at a time. Here see it has gone. Another test is a directory. This is a sub directory of that. Yeah, directory is another directory. It is another sub directory of another test. Inside that there is items. So, it has listed all directories, sub directories, files within sub directory, everything has come on the screen. Because it has come so fast on the screen, we have piped it to less. Instead of piping it to less, anyway we are interested only in PDF files. Why do not we say name star dot PDF? There is no PDF file. I think scouts perhaps are wrong. It has listed all the TXT files. Since an important change, the slide, let us go back to the slide. So, here these codes have been put wrongly as open code. We will change this. Open code as I said is about executing whatever is inside that open code. We want double codes here. Maybe single code will work. In any case only close code. So, please note this important change when you try to do this. Why? Let us go back to this. This is what had worked. This lists all the text files. All the text files not just in this directory, sub directory, everything together. Yeah, whatever ends with TXT. It does not know whether actually the content is PDF or TXT. That is what you will do by using the file command. What about single code? Single code, closed code, let us see. Inside the name, there is this. That is also working. You might want to see ls minus l of this. It is doing ls minus l of only these files. So, it is doing ls minus l of all the TXT files not just in this directory. This directory, sub directory, sub sub sub directory, everything together. Sub. Now why do not we do find it says find dot minus type D. This is listing out all directories, all directory names inside sub directories, etcetera. So, please do man find. There is a whole lot of complicated things one can do using find. Now, for example, you might say look that day I had written some important text. I had written something about an A. In that some text file. Which text file I do not remember, but I am sure I kept dot TXT extension. And inside the TXT extension and word has to be there. Why do not we grep through? Why do not we grep through all the TXT files inside this directory and sub directories? Grep for and inside which file name? Not just one file name. Inside a list of file names. Which file names? All the file names that will come out as output when you execute this command. When we execute this command up to here. There is a whole lot of this TXT files not just in this directory, but this sub directory, its sub directory, sub sub directory. All the TXT files starting from this directory and its sub directory. This dot here means that all that list through all of them in one go, we can look for this pattern and that is what we are going to do now. It says, yeah, yeah, I found an inside this file. I also found an inside this other file. This we had done some copy paste together. Do you see this power? You do not have to open so many files. Each file might have so many lines in such one command one could open all of this. So, somebody has some question here. Pond please, I am sorry. So, what does this do? This says find this is executed. When just this much highlighted portion is executed, lot of TXT files that are in this current directory, sub directory, all of them have come on the screen. Instead of that list coming on the screen, that list of files is fed as the file name as a list of files for the grep command. Grep now will look for this pattern inside all of those files. Grep anyway can take two file names. It can take two patterns we already saw. Let us go to these examples. Sorry. Here we have bigger, we can look for an inside bigger items, new. It did not find in any of them. Let us see what is there, what is there in this? Instead of an, we can look for, it has found inside all of these files. Inside each file it is telling all those lines where it has found. So, grep, somebody asked can you search for multiple patterns that we already saw you have to use a minus e option. As soon as you stop using the minus e option, of course first one is the search pattern itself, but we did not give any minus e option. That is why it expects this to be a file name it has to search in. More arguments are being given. These are also supposed to be file names inside which it will search for this pattern. So, multiple patterns are possible, multiple files are possible. For multiple patterns of course you have to say whether this is or or and minus e option means or. Any line that has either this pattern or that pattern, if you want and then just pipe the output to again grep. That is the easiest I can suggest, but because you all know pipe now, see help grep to see how to use the and option that we will not discuss here. If you find this out just write on Moodle, do not ask on Moodle how to do this because we have already seen one method. So, let us go to the next topic in fine. Compare, very important. We write so many files, we are not sure which is the latest. We think this and that must be same. Why do not we compare two files and see? So, what does this do? Compare file name 1, file name 2. Now, when you do find minus name quick.c, maybe you get these two files both are quick.c. And then we might have saved it in c folder very systematically or we might have just kept it in desktop. Now, we are not sure which one is the last one. We think maybe they both are the same. One thing is to do to see the timestamp. But as we saw yesterday, unless you do cp with the minus p option, the timestamps will have changed. The one that you copied, new destination will have the newer timestamp. So, timestamp is not going to tell you which is the whether they are the same or not unless you use the minus p option. So, compare file 1, file 2. We will just tell you whether two files are same. If the two files are the same, then no output is generated. Else it will give you where the first difference occurs. If they are indeed different, then if the two files are not the same, then one should use a diff command. A different cmp are almost the same. I suggest just use diff. Do not worry about cmp. If you know that the files are different, then you want to know the exact differences. Diff, file 1, file 2. This particular forward slash is for because it is continuing to next line. That is all. So, diff file 1, file 2 will say line by line which is different. If some lines are shifted below, it will not get confused. It will know that actually that same line is occurring further below. Those are actually same. We will say what indicates only in greater than means the right side. Left than means left side. So, we can see a quick example. So, that one will tell you what is only in one file, what is not in the only in other file. Whatever is in same, whatever line occurs in both is not shown on the screen. So, for this purpose, why do not I change this prompt? Somebody had asked how to change the prompt. Please pay attention now. Why do not we change it to dollar? Because now we have greater than less than sign coming again, again. So, this is our prompt. PS1 is a shell variable that decides what the prompt should be. It does not have to be exported as you noted just now. So, cat items, why do not we copy items to items? So, items copy, CMP, CMP for compare. Items, they are exactly the same. We copied this now. Of course, now no output is expected to come. Why? Because we have copied it. What about def? Again no output. Why? Because they are really the same. Why do not we make some small change in one? We will remove here one. Some principle will change to another correct spelling. But this is our college principle. It is no longer the principle, Maxwell's principle or no longer principles, techniques and tools. It is the principle of the college now. So, why do not we, so now we will see CMP. It says there is some difference, some byte difference. Not very meaningful information. Why do not we do def? So, we will pipe this through less. So, important to note is first one, first argument is items.txt. Second is items copy.txt. And all our differences are in items copy. It says the left side one. This means left side one. Items.txt had actually manned. Now, we have to visually see and see what the difference is line by line. While here we see that month is not there. So, this is the left side. This denotes the left side one. This denotes the right side one. Similarly, it says on line number 8 also there is a difference. That particular difference is line 8 of both the lines, both the files. 8 C 8 means number 8 for left one, number 8 for right side one also. I think you can spend some time to decide, understand what is the meaning of this. Especially if that particular line which is different is on different lines, then how to make sense of this. Here there might be an extra line in one file because of which here the count might go. There may not be 8. So, it is C 8. So, here it is again saying, see the left side file was having l e while the right side is P a n. These are the only two lines that are different. So, that is how we see different compare. Why do not we see the next slide? TAR. TAR ball. How do you zip files? TAR ball is extremely commonly used. So, TAR is for collecting lots of files, lots of directories, big directories all making it into one file. TAR is what is to be used for that. So, default TAR will not compress it. It will just combine them all into one file which is easy for sending it to somebody, using sending it by email. Also easy for zipping it. After you make it to one file then zipping it is easier. Unzipping also you, anyway you are going to send one zipped file whether you zip them separately and then combine them or you combine them first then only once the zip command has to be run. For those purposes TAR will default only combine them into one. It may not compress. So, what are the various options to give? Why do not we try this? Make directory extract. So, it says first about extract because we are, as if we are giving you a TAR ball already but why do not we create a TAR ball first then we will say how to extract it also. In all the directories, files, directories we have. Look we have so many files, directories. So, why do not we go one directory and PWD? We will go to one directory before. Inside test files this one using Linux tools is the one that we spend lot of time on, made various sub directories, directories perhaps lot of useful information perhaps. Clearly today it is not useful information. They were all some test generations. So, we will like to create TAR minus C, C for C, C for create a archive, E F file name 1, let us go using dot TAR. You can give any file name instead of 1. Why do not we just say 1 dot TAR? 1 dot TAR you want to make a archive. The archive is eventually going to be called 1 dot TAR of what now of the directory 1, 1 using Linux tools. It is made this 1 dot TAR file. 1 dot TAR file has got created now. What all is there inside that? All those whatever came on the screen all those files have been combined only. Do we also want to zip this? Zip, gzip 1 dot TAR. When it is zipped it will, when it is zipped it will give 1 dot TAR dot gzip. Now we would like to, this is now it is a small file. We can send it to somebody by email. After it is sent by email that person can again open it. While sending by email it is only one attachment. Why do not we make a different directory and then open it there? Otherwise it will overwrite this particular 1 underscore using Linux tools. It will overwrite to the best of my understanding. They just overwrite this. If any files are different they will get overwritten by this. Files that are not there in the archive I think they will not get removed. Make directory extracted. Where is our 1 dot TAR dot gzip? It is there in the previous one. Go to the parent directory and move it here. Here it comes. First thing is we will gzip it. What is g about it? It is the zip algorithm, unzip algorithm that has been written by GNU by the GNU movement. G for GNU I think. Help gzip will tell you in detail. Please do not look now. This is something you can also see later. You want to first gzip this and then we want to extract out that archive so that gzip has been removed. These extensions are important. What about the TAR? TAR now we want to extract it. So, even though we had given it the name 1 dot TAR that TAR file had this information that the directory was actually called this. It will not open it to directory called 1. The directory name is also contained inside 1 dot TAR. That is the all the more reason that you should be careful when you are extracting it. You do not even know what directory will get created. The same directory might already be there. Typically in reports, so many chapter 1, chapter 2, it will just everybody says chapter 1, chapter 2, chapter 3. It will override existing files. Always good idea to make a new directory, take it inside there and then use this. Even though the file name is 1 dot TAR, the file name, the directory that will get created is whatever was the directory that was compressed that was combined because of which please pay lot of attention to this and do not end up overwriting your files. Now one can check. All these files are there. These are different files. These are inside the extracted directory. Now you might say if I was anyway going to compress it, why do not I give another option to TAR and also compress it in one go. So, TAR everybody has understood. TAR ball means what? 1 dot TAR. That is called TAR ball. It is like all these nutritious things, various nutritious things are all first put together in some cup, some motorist mix. You make a ball out of it and give it in one go to the child. It is like TAR ball for the purpose of sending an attachment. You have made one TAR ball of all the existing, all the required fines. I think this ball is best understood as TAR ball that you combine all these various things into one ball that you can, if you want to throw some particular object to 10 objects to somebody very far, you make them into a ball, put them in a bag and then throw it, make one TAR ball and throw it. After all this purpose is for copying it from one server to another, copying it from one directory to another, copying a directory inside the same computer. Anyway you can use CP minus R. It is for sending this big file as an attachment or for copying this file from one server to another. That is when TAR ball is extremely useful. During all those purposes, anyway we want to compress it. If you want to compress it anyway, why do not we give another option and compress it in one go? Rather than later on give, later on use GZIP or GUNZIP option. So, there are different compression algorithms for those who work in compression. You will know that different compression algorithms are there. Why do not we see those options inside the slide? TAR can create and extract compressed archives also. Supports compressions like GZIP, BZIP2, LZMA, some compression algorithms. So many people have done so much research about these compression algorithms. It would not be good for me to trivialize it and say of course it is this, of course it is that. Please see help, see the compression algorithms. How do you give those options? If you want to use GZIP compression algorithm, just combine Z also minus CVFZ, then the file name. That will also make a ZIP of it. For example, TAR minus CVZF, Z for GZIP will create this. This is our, this is anyway choice we are doing. And of course you can also, you can also compress all TAR.TXT, combine them. Instead of directory you can also take TAR.TXT. So, we will also now see how to extract out with this addition options. When you are extracting out, if it was already compressed, then you should use the Z option. In addition to X, VF, V means verbose. It will just give you a lot of information on the screen. You, whether you put V or not, the file that is generated is the same. X for extracting, if that particular archive that you extracting has already been compressed, then you can include a Z option also. Z if it was compressed using GZIP algorithm. So, now somebody sends you TAR file and has not given extension properly. Does the file, will the file command give you this information? Why do not we see that? Let us see file 1.TAR. It says TAR, some GNU. TAR is also GNU command only. Why do not we zip this and file 1.GZIP compressed data. It was originally 1.TAR. We will send some information that is coming out by file. As I said, if you move this to 1, the information about what the file is is still the same. Extension is not going to carry this information, but we should, we should, it is not a good practice to do this. Now, TAR minus CVZF1 dot, if you are combining in one go, no need to write 1.TAR.GZ, just write TGZ. All these extensions are understood by Windows extractors also. In Windows also, when you compress a file, extractor to a file, they all can understand TGZ, TAR, GZ. They can understand these extensions. So, do not have to worry about that. I am sending this file to somebody who does not know Linux. Will he be able to unzip it? Will he be able to extract out the archive? Yeah, most of these can understand these extensions anyway. Anyway, importantly, we should be asking them to use Linux rather than making it compatible with them, but that apart. So, now 1.TGZ has got created, again from 1 underscore using Linux tools. Why do not we see this? Again, it is the same information. Finally, whether you do TAR first and then GZIP or you put the Z option, the file is the same eventually. We want all of you to submit, whenever all of you are asked to submit some files, you will always submit a TAR ball and using the GZIP. We are not going to be happy with multiple files, just plain files, especially when we have told you to do a TAR ball. So, please read all our instructions in future about assignment submission. We will ask you to make tech files later and submit. PDF files we will ask you to submit. In all those instructions, if we have asked you to make a TAR ball, if we tell you submit 1 TGZ file, then you will always do this. Please keep note of this. We will give 0 marks. You should thank us that we are not giving negative marks for not following this instruction. Please allow us to give you 0 marks for not following this instruction. Which instruction? Whenever we tell you to submit a TAR ball, whenever you submit, ask you to submit a TGZ file, you should know what to do about this. Submit U star minus C V F Z file name dot TGZ and submit. I hope this is very clear to you. If you do not ask, please ask now because we are planning to give 0 marks for anybody who does not follow this instruction. So, nobody has asked a doubt. So, I presume it is all everybody has understood this. So, our next topic is customizing your shell. So, before we start with customizing the shell, there is just one, somebody had asked where are all these commands? For example, file. File is somewhere in the path. Why can I say which file? It happens to be in this particular place. Which echo? Every command that we are running is a file somewhere and if you want to actually see it, you have to ask which file and see. Of course, these are all extremely commonly used. They are not going to be available as batch script. They are also a command, but they are not batch script. We can see what type of file is it? Some ELF 32 bit LSP executable. Executable means not EXE file, but it is a source code is available in the Linux kernel, but it has been already been compiled for fast execution. So, dynamically linked etcetera. So, you can see for anything files, what we have done? File of slash user slash bin slash file. File command itself is actually a file. That is somewhere in the path. We are seeing what type of file it is. It is some complicated file. Somebody had asked yesterday, what all type of files are possible? Please do not ask anything on model. I have already told you. I do not even know what all files are possible. Plenty of files are possible. You can try various things. See health files, see on the net. What all types of files are possible? So I have told you how to locate a particular command inside your path. The next thing to do is customizing our shell. This I already told you that when I use my shell, I am always used to running RM, MV, CP in alias mode, always in interactive mode. For that purpose I have already aliased them. Aliased them to RM minus I. I have aliased RM to RM minus I. So, where has all this customization been done? You all would like to customize your own shells. So, this is our side about customizing one's own shell. Whenever you start a terminal, bash first reads slash hit is a slash profile. There can be small variations in the sequence. In the various computers I have seen of late, there can be small variations. But these are really small variations and that too for advanced things. For the basic things there is hardly any change. You can open this particular file slash hit is a slash profile on your computer. There it will say if the user himself, user himself or herself has a dot profile file inside one's home, then that should be executed also. These are some things if then now after having learned this much bash in our course, you will already be able to understand the profile slash hit is a slash profile slash hit is a has various such configuration files. Then there is a dot bash profile inside your home directly. Tilda, I forgot to tell you. Tilda means home. We already saw this. Tilda means your own home. It is same as dollar home. There is also that dot bash login that gets executed when you login. These are like just some initial commands like that good afternoon, good morning kind of things you can put in dot bash login. They are executed only once. Typically shell settings are not going to be there. Shell settings are either in profile or dot bash RC. Then dot bash RC is read when not a login shell. Whenever you open a terminal, I think that is what this means. Whatever commands you put in here, they will all be executed. So, let us see what is there in my dot bash RC. So, let us come to this slash hit is a slash profile. It says if this file exists, then done some unset. All these variables I that get created, they all are going to remain as shell variables. So, we do not like so many shell variables. We already decided that only capital should be such environment variables. All the small letter variables is what the user should create. So, it is a good practice to unset it and that is what this profile is doing. PS1, PS1 you have already seen. PS1 is going to set the prompt. If that is already there, fine. Otherwise, this is some default PS1 that is being set. Dollar is going to come at the end slash W is some working directory. Whatever directory you are working in. Not the entire path, only the last directory name in the path. H is I think the time of host host. What host? U is the user name. So, these are things you can see by help bash. It will have all this information. Now, if this file exists, you already have seen if this file exists in square brackets, notice that they are not wasting too many lines. This then was not on the next line. It was on the same line. We already saw on the same line if you want to put multiple things, you should put semicolon. You already saw. Dot is for source. Execute that if it exists. Dot bash RC, bash dot bash RC. Do not have to have execute permissions. They are not commands. They are just some settings. Why make them a command? So, they have just sourced it. Dot. Notice that with dot, you do not have to give execute permissions. There are some other settings about the prompt. Let us see slash, etc slash. Whatever bash RC, bash. There are several bash. Some system variables are being set there. Some ch root or something. Only yesterday I came, ch root is for some security reasons. So, that some system files do not get modified by malicious code. Where are we now? Let me see my own dot bash RC. There are two, three. One is bash aliases. What are my various aliases? I have aliased r m equal to r m minus i. This is whole lot of aliases. So, all these long, long commands I do not like. I use some package called silab. There are two versions. So, for that I have set silab 1, silab 2, some finger. Various such commands are all there. This is our dot bash aliases. Dot bash aliases is not something we already saw in the slide. Where will all these aliases get read? Why do not we see that? CD. Why do not we grep for dot bash aliases? This is the pattern we are going to search through all dot star files in order to see where exactly aliases are being read. So, it says inside dot bash history, this dot bash history is list of all the commands they executed. How many? All. I might have been using this computer since several years. There is some setting. HIST file size I think. Some environment variable called HIST file size. In that print n that we saw, there is a HIST file size, some environment, typically HIST file size. It will say how many history commands are going to be stored. We do not want to say too many. 1000 must be enough typically. Dot bash aliases also was there in history for the same reason. What dot bash r c? It says tilde dot bash r c, but that has been commented out. So, clearly it is there somewhere else. In my dot bash r c, it says this. If that file exists, so that if that file is not there when dot bash r c is going to execute this line, then no error will come. This line is there only if that file exists. So, this is where all my aliases are written. You are also encouraged to write your aliases. What is there in the dot bash r c now? Some I copied from somewhere else and made some changes. Editor. So, there are many places where some editor is helpful to have this editor variable. Now, do not worry about this editor variable now, but there are various places. Tech inputs. When very soon you will learn latex and in latex you need to keep your own files. For example, I have my own style files in latex. Are we going to copy this style files? Each time we are going to build a tech file. No, I keep all of them in my home in dot tech inputs. Whenever I latex, it will look for those files here also. Some whole list of things are the his, his size is here. His size, 1000. His file size is something else it appears. All this is here. Then I also keep some useful commands here. So, if I some command line, command line to convert a doc file to PDF file from the command line. If somebody sends us a doc file, we want to send a PDF file. Do we have to open, do we have to really open, open office and then press the PDF button? No, from the command line it seems to be possible. Some things have, some useful commands have written and kept in my bash r c. So, all this personal settings are possible in bash r c. That is the purpose of this slide.