Welcome to this lecture on digital communication using GNU radio. My name is Kumar Appaya and I belong to the Department of Electrical Engineering at the Indian Institute of Technology Bombay. This lecture will be a continuation of our discussion on error correction codes. In particular our focus will be on binary hamming codes and we will implement them on GNU radio using embedded python blocks. Embed python blocks gives us a very powerful way of realizing these hamming codes because we have full control over the way in which the coding is implemented. Our focus will be on the 7-4 hamming code that is the code takes 4 information bits and encodes them into 7 coded bits and this code is very useful in the sense that any single bit error can be corrected without any loss in fidelity. We will see and confirm that the hamming code works and we will inspect its performance in various scenarios. If you recall from the previous lecture the hamming code was defined in the class using the parity check matrix initially wherein we chose 1 1 0 1 1 0 1 1 1 as the initial part of the matrix followed by the identity matrix. Subsequently we used this generator matrix where we place the identity matrix and the transpose of this matrix which means that the columns are 1 1 0 1 1 0 1 1 and 0 1 1 1. Let us first see how we can implement this generation operation using python so that we can then translate this to building a GNU radio python block. We will now use a python prompt to check out how we can create the generator matrix and check all the code words that are possible. Remember for the 7-4 hamming code there are 16 possible 7 length code words. Let us first begin by writing the generator matrix. We will first import numpy. Once we import numpy by typing import numpy as np let us first construct the generator matrix G. We will first create a zero array and to ensure that the data type is what we want we will say d type equal to int we will just specify that this is 4 7 so that we have a 4 cross 7 matrix. Now we know that the first 4 by 4 sub matrix is an identity matrix. So we can do colon 4 comma colon 4 this accesses the first sub matrix. So now if we set it to I4 if we check our G you see that you have the identity. Now all we need to do is to specify the fifth sixth and seventh columns which correspond to the four five and six columns because python uses zero based indexing. So let us now just enter make the entries properly. So we are going to just say colon comma four is equal to now this will be then colon comma five will be and colon comma six will be. Now if you inspect our G this is indeed the generator matrix that we wanted. For the next step let us also construct the parity check matrix but since we have constructed the generator matrix constructing the parity check matrix is easy because the parity check matrix has an identity on the right and the transpose of this A on the left. So we can just take this part of G that does not have the identity and use that to set the values of H. So let us begin we will set it to zeros remember the seven four three Hamming code has a parity check matrix of size three cross seven. Next we specify that the last three columns are an identity matrix colon minus three. So all rows the last column onwards. So we have placed the identity matrix in the second half. Now we just need to take G's second part and take its transpose and feed it in as H's first part. So we can say H colon four is equal to G all rows four colon transpose. Now this is the parity check matrix that you wanted. How did we get this remember in the lecture we discussed that if G had the form IA then H has the form A transpose I for a binary matrix. If you want to verify that this is indeed the correct pair of generator and parity check matrices it is very easy. We just need to perform modulo two matrix multiplication. So let us do H multiplied by G transpose. If you do that then you will get numbers let us do this here you will get numbers of the form two two zero two and so on. But remember we want to do XOR operations which means we want to perform matrix multiplications modulo two in which case you get the all zeros matrix. Now this is fine but what are all the sixteen code words. So to get all the sixteen code words let us actually just go through it manually and get it. So for example I am going to now start encoding all the possible four bit vectors. So for example let us say my messages is we will say zero zero zero zero zero zero zero one zero one one zero one zero zero zero zero one. Then I am going to have zero one one zero and zero one one one. Now if you look at this right these are eight of the messages I wrote them manually but of course I need to add the ones where there is a one in the front. So I can just say something like this this is in python I can write a list comprehension I can say something like one plus i one colon for i in M and this will give me the corresponding entries for one what this does is it takes all the entries from the second one onwards each of these and prepends one. So now I am just going to do M is equal to M plus this and I have all sixteen binary vectors. In fact you can do this more efficiently with some other methods but I am just sticking to this. So now I am just going to say code words is and all I am going to do is I am going to do this list comprehension approach I am going to just multiply this M by G transpose. So I am just going to say M sorry say I at G transpose for I in M sorry so if you look at G and if you look at M and if you look at M zero multiplied by G sorry I am sorry I should have multiplied by G directly so I am just going to say code words is I at G for I in M. So now if you look at the code words you get all sixteen code words but you see the mistake that we made we did not do modulo two so all we do is we say percentage two and if you look at code words you have these. Now these are perpetually the hamming code words there are sixteen of them to verify that these are indeed the valid code words we can use the parity check matrix so we can do something like H at I for I in code words of course modulo two remember to do that and indeed they are all zero confirming that these are valid code words. Let us now make a final observation of these code words look and you can check that no two code words are going to be are going to know any two code words you pick they will differ in at least three bits that is you take the first one in the second one they differ in four bits this these you know these two differ in these three bits so there is always a difference of at least three bits among any pair of code words. Now the final aspect that I wanted to mention is if you want to implement this in GNU radio then we need to actually perform the XOR operation of course one way is to add you know add them and perform modulo two but there is another way let us for example take the error vector I am going to take an error vector say zero one zero zero zero zero now if I say H at E modulo two I get this syndrome okay that's that's basically the error syndrome and if I want my Y to be a code word let's say I take code words four and if I want this E to be XORed with this it's not very obvious as to how you can directly do it of course you could just make this E into an umpire A and you can just do code words four plus E that will give you this error I mean that'll give you the erroneous sequence if you do modulo two you have to put it in parenthesis but this is a little cumbersome an easier way would be to directly do the XOR and it turns out that you can do this XOR using the XOR operator inbuilt into Python so this does the XOR by twice I mean it's like there was this the XOR of each of these elements for example if you take one XOR two remember if you express these in binary one is expressed in a byte as seven zeros followed by a one and two expressed as six zeros followed by one zero so the XOR of these two will give you one one at the end which is three similarly if you do four XOR one you're going to get five because it's like one zero zero XOR zero zero one and four XOR two is going to be six four XOR three is going to be seven and four XOR four is going to be zero so you can directly perform the XOR using the carrot operator in Python and that is what we're going to use in the GNU radio implementation for our implementation in GNU radio we will take the same approach as we took earlier wherein we construct a binary symmetric channel using a Gaussian channel and use the Hamming code in parallel and show that the error performance is improved let us quickly put together the same elements let us begin with a random source control f random source a binary source is enough because we will use BPSK we will use byte to control f or command f we'll get the constellations related aspects we'll get our constellation object we'll get our constellation encoder we'll also get the constellation decoder and place it here because we will need it soon the constellation object we will call it my BPSK we'll make it a BPSK constellation we'll make this use my BPSK copy this also will use my BPSK we'll connect these over here we'll add a throttle control f or command f we'll say throttle next we will add a float you know complex to float complex to real in fact control f or command f we'll say complex to real we'll add a noise source control f or command f we'll say noise we'll make this a real noise source which has amplitude noise std of course we'll add a range that uses this which starts from zero goes up to let's say 10 steps 0.1 we'll add we'll have an addition source I mean adder control f or command f we'll say add this add will take float we can combine this combine this and finally this is going to be decoded so we'll add a float to complex control f or command f we'll say float to complex as usual this is the real part the imaginary part has to be 0 so we'll get a constant source control f or command f we'll say constant we'll take a constant source that has a float 0 connect it over here connect this to the constellation decoder view these in a time sink so control f or command f we'll say time sink we place the time sink the time sink we can give it two inputs we'll also make it float then we can just add a character to float so control f or command f we'll say care to float and convert these bytes so that they can be viewed over here another care to float to view the original constellation or original bpsk's basically so now if we observe they overlap very nicely if I increase the noise you will see that the blue and red don't match because there are errors in order to again visualize the errors we can add a histogram sink let's first rotate this by using the left key so that it's easier to lay out I'll rotate this also I'll rotate this also to the right a little bit maybe the I'll just keep this as is now I'll add a histogram sink control f or command f I'll say histogram sink and the way our histogram sink is going to operate is that you will essentially take these two subtract them and take the absolute value subtraction will give zero one or minus one a minus one or one indicating an error so we'll say control f or command f we'll say subtract the subtract operator which takes float we'll take this we'll take this this is going to be viewed on our histogram sink and if you execute the flow graph you see there are no errors if you increase this you will see that there are errors because of these plus one and minus one let's just change things around let's make this go from let's say zero to one and let's also remove the auto scale and now the only change which you have to make is that we want to add an absolute value over here so we'll do control f or command f and we'll say abs and this absolute value we'll rotate double click make it float goes here goes here and now we are set we can now get a visual on the errors so the correct is here the error is here let's just make things a little more convenient by making the x let's say minus 0.5 and now you should be able to see both so as you can see there are errors over here now we are set I think it's adding cumulatively let me get rid of that also accumulate should be no we can add a grid now we are set we can always just visualize the errors over here by counting these and comparing with this this is the number of correct number of errors we are now set with the base now we have to repeat this with a hamming code now in order to repeat this with a hamming code let's just make our flow graph a little more comfortable convenient and we're going to take the same random source but we're going to duplicate many of these in order to get the you know get the bits out and the right and the hamming code and everything we'll do that as we proceed the first thing is that we take the random source and we need to now perform the hamming encoding so for that we will use a python block that takes in these bits four at a time and yields seven so the first thing we're going to do is we're going to demultiplex the stream so ctrl f for command f and we'll say stream demux we'll double click we want to demux this into four so i'll do star one multiplied by four and put four here and i have my four demuxed stream with data type byte i'll also add the stream mux that will be needed over here not surprisingly this stream mux will need because we're using a seven four hamming code we will need seven and seven which will be byte type we will now make the hamming encoder the hamming encoder will be implemented as a python block so ctrl f for command f we'll say python and we'll grab the python block we can double click to edit it we'll say open in editor we'll choose whichever you can choose any convenient editor in which you can write python now as always we'll remove the unnecessary content so that we can focus on the code we don't need this example parameter we don't need this we will name our block seven four hamming encoder and it takes four int eight inputs and yields seven int eight outputs and we do not need any example parameter we do not need this and this is just going to change we're going to have output items 0 1 2 3 4 5 6 and input items 0 1 2 3 and we're just going to exhort them okay so now the question is how do you exhort them if you look at the generator matrix it is evident that the first four elements are directly going to be repeated directly from the message because the message appears as is then the fifth element is message ones messages bit one XOR with bit two XOR with bit four so it's like one two four one three four and two three four are XOR to get the remaining three let us implement this using the XOR operator on the GNU radio python block so a direct way to do this is to just implement the same thing on the first four 1 2 yeah so 0 1 2 3 3 2 1 so we have now completed the XOR operation sorry we have completed the encoding operation for the first four bits for the remaining we will use the XOR operation this is the redundancy now output items four which is the fifth bit is remember it's the first the third and the fourth so I'll say input items 0 XOR input items 2 XOR input items 3 next output items 5 is input items 0 XOR input items 1 XOR input items 3 the final one is output items 6 is input items 1 XOR input items 2 XOR input items 3 you can verify that this is indeed the correct implementation of the XOR operations that correspond to the generator matrix I think I believe I got these swapped around yes so this you can verify because it is 1 1 0 1 1 0 1 1 0 1 1 1 now we are set we can just save and exit and we have our hamming encoder ready now of course we could have implemented this as a matrix operation as well but I thought it would be more instructive to implement it in this manner now let us connect the stream and let us deem you know let us multiplex the stream back so that we are ready to transmit this and the hamming encoder is done now we need to perform the same modulation operation and addition of noise and so on let's do that by copy pasting I'm just going to copy the encoder control c control v we have our encoder and then we'll have a complex tutorial control c control v we'll have a complex tutorial then we'll have noise control c control v we add noise control c control v we have an addition block next we will do a float to complex with a constant source so control copy we'll we'll just copy these directly control c and control v and move these over here and we can just connect this let's make things a little neater by moving things around a little bit so I'll move the stream demux over here the hamming here the stream mux here I'll make more space so complex I'll put the noise maybe a complex tutorial I'll take here noise source here add take the constant source and now you have a constellation decoder we'll make some space over here and we'll rotate this to the left okay um yeah so one thing is before we do the character float we need to perform the hamming decoding now for the having decoding we will use a syndrome based decoder for which we will use the parity check matrix that we saw earlier so we will implement this particular parity check matrix and as you're aware by directly looking at which seek syndrome we get and finding out which index of h that is we can directly compute where the error is and let us now perform that operation let us grab a python block again and again start editing it let us once again start making our edits so we can get rid of this get rid of this now we need to make our seven four hamming decoder and as you remember this has seven inputs and four outputs we don't need this example parameter we don't need this and now we come to the main part of the code where we need to find the syndrome and based on the syndrome we can just flip the bit and because our codes generator matrix has the form where the original four length sequence appears in the first part after flipping the bit correct bit we can just read off the decoded data by looking at the first four bits now let us do our decoding process the first thing is to find our syndromes all we need to do is we need to perform an three appropriate exhaust okay we need to perform three appropriate exhaust of our received you know inputs so i'm just going to say this for convenience let's just write down the hamming parity check matrix over here as a reference so let us write the parity check matrix 1 1 0 1 1 0 0 1 0 1 1 0 0 1 1 0 0 1 this is the parity check matrix now we are ready to perform the operations to obtain the syndrome so we are essentially going to take this as the first bit this is the second bit this is the third bit so i'm just going to say syndrome one is equal to i'm going to take all input items on mass XOR so i'm just going to find the first syndrome so i'm going to XOR input item 0 with input items 1 because it's 1 1 0 i'm not going to take input items 2 i'm going to take input items 3 and input items 4 and with this i get my first syndrome then syndrome 2 is going to be input items 1 1 0 1 1 so and then XOR input items oh it should be 0 sorry and then put items 2 and then input items 3 and XOR input items 5 because it's 0 1 0 at the end finally syndrome 3 3 is input items 1 because 0 at the beginning XOR input items 2 XOR input items 3 XOR the last one input items 6 now to find the overall syndrome and say syndromes i'm going to take the first syndrome as the least significant bit this is the second and this is the most significant bit so i'm just going to say syndrome 1 plus syndrome 2 times 2 plus syndrome 3 times 4 why am i doing this that way i'm going to now treat these as numbers for example this 001 is essentially this the number 4 0 1 0 is 2 1 0 0 is 1 so let's write those numbers down you know so the effective syndrome that i am going to consider remember the first one is my least significant bit so this is 3 then the 1 0 1 is going to be 4 sorry 1 plus 4 5 0 1 1 is 6 1 1 1 is 7 then 1 0 0 is 1 0 1 0 is 2 0 0 1 is 4 so this corresponds to the the syndrome based on which syndrome this is i will correct that particular bit so let us now move ahead so now what i need to do is i need to now perform a correction of the bits appropriately i'm just going to correct it directly in the input items based on the syndrome so let's go through this for i in and i'm going to say for i and syndrome in enumerate syndromes now this will give me an you know iterator as well as the syndrome so now based on what syndrome i get i'm going to perform the correction so let's say i start with 3 if 3 is the syndrome i get the first bit is an error so i'm going to say if syndrome is 3 i'm just going to swap the first bit so input items 0 i is i'm just going to swap it 1 minus input items 0 i this is the first bits l if syndrome is 5 this corresponds to the second bit being flipped so i just need to flip the second bit so how do i do that i just press 1 here let's copy this and then let's look at the third bit for the third bit the syndrome is 6 i have just put 2 here for the fourth bit i'll just put all of those fourth fifth sixth seventh okay i need to do it only for the first four because others don't matter but we'll just do the full thing anyway so for the third bit it's six so we have three five six for the fourth bit it is seven and this is going to be three this is going to be three for the fifth bit it is one and two and four here and this is going to be four five six six five four now we have essentially corrected all the one bit errors by finding the syndrome and swapping the corresponding bits if the syndrome is zero then none of these essentially get activated and no corrections happen which is the way it should be now the final thing is to copy the outputs back and for that we will use a line like this output item 0 is input items 0 output items 1 is input items 1 because these are corrected and the first four bits in the input correspond to the actual message and with this our decoder is done so let's just show the decoding code so this decoding code essentially performs the syndrome detection and based on what syndrome you get you are able to correct the errors let us save this now we have our having decoder now to use our having decoder we need to split this constellation by demuxing it so controller for command if we'll say stream and we'll get the demux the stream demux we will rotate hamming code also we can rotate the stream demux is going to be of a byte type taking seven inputs sorry one time seven seven and connect this over here we have now connected we'll connect these corresponding over here and then we need a stream mux so we'll grab a stream mux we'll rotate this also this is going to be a byte type one times four we need four connect these and get the care to float and again we'll do the subtract we'll we can first connect it to the time sink we'll make it three we'll add a histogram input we'll make it two we'll connect this directly and again add a subtract and abs so control c and control v we'll add a subtraction get the original and get the abs also we'll do control c control v we'll get the abs over here connect this over here and now we are set now if you execute this flow graph you can see yeah if you set it to this noise level you can see that some amount of error correction seems to be happening let's do one thing let us actually increase the number of let's increase the histogram number of essentially points and let's also increase the number of samples and let's perform this with some noise if you wait long enough you will see the blue one coming up slightly if you put it here you see the blue one while the red one is slightly below because single bit error seems to seem to be corrected let's move it a little back it takes time for it to settle you will see that the peak of the red one is always lower indicating that one bit errors are being corrected if you want to confirm that all one bit errors are being corrected you can actually play a trick just to confirm for example if you have even in the absence of noise you can manually introduce a bit flip here and check for example let's do that let's just do control f for command f and we'll say add constant add add constant and we'll just make this into a byte and we're going to add the constant minus one so this is doing minus one plus the bit and we'll multiply this by minus one oh we'll do multiply by constant and make this we have to multiply by constant for sure it takes a float fine let's do one thing let's actually add the bit error here manually let's just edit the hamming encoder and then add some error okay let us just introduce the bit error in this bit this just flips the bit now let us execute our flow graph yeah so this multiply has to go if you execute our flow graph you will see that there are no bit errors that have occurred because the having code corrects single bit errors accurately because that we have implemented it correctly of course let us now reset it so that we don't have that manually introduce error and with this we can confirm that the hamming encoder is able to correct one bit errors accurately even in the presence of noise let's wait you can see that the error correction is very effective so in this manner we have implemented a hamming encoder and decoder using a python block and this is a very very powerful code and GNU radio also has other code facilities for example if you just say control f and type error or rather you say you know coding you can look at read solomon error coding yes you can say feca sync decoder encode and all those things you have all polar code you have all these kinds of encoders and decoders that you can put together and use to good effect as a final closing and optional remark one aspect is that we have implemented our decoder quite inefficiently because of the fact that we checked every syndrome and flip the bit basically manually so there is an alternative way the alternative way is to use python to good effect and use a mapping between the syndrome and the bit to flip in order to perform the flip in a more efficient manner so let's for example look over here so over here it is evident that if the syndrome is three then the bit we have to shift is zero the syndrome is five the bit we have to shift is six and so on so we can create a simple mapping using a python dictionary we can say syndrome map and we can just create this dictionary manually so we say we map three to zero five to one six to two seven to three one to four two to five and four to six this syndrome map is now a very convenient thing so we don't need to write all these lines all we need is a single line over here we just need to say syndrome map of syndrome copy is equal to now the advantage of this code is that if the syndrome is three then syndrome map of syndrome is automatically zero and the zero bit is flipped in fact let's actually just make it a little more readable let's just use this to get the index and say idx is this and we just so say idx and idx this way you have made the code much much simpler because you just have a mapping between the syndrome and the actual bit flip that it corresponds to we also have to confirm that the syndrome is not actually zero if syndrome is not equal to zero if syndrome is not equal to zero syndrome being zero is what we had to check now if you execute the flow graph you get the original performance back if you add the noise you will see that let's reduce the noise a little bit you'll see the hamming code works pretty well in this lecture we have seen one way to implement the binary hamming code on GNU radio using the embedded python block you can go ahead and discover several other error control features that are inbuilt in GNU radio but the use of the embedded python block gives you a simple yet powerful way of realizing the hamming code we have also verified the single error correction ability of the hamming code by def deliberately introducing a bit error and seeing that the hamming code is able to correct for this error in the coming lectures we will see how error correction codes also fit in as part of a as part of the building blocks of a communication system and see how you can use this to improve the performance of your communication system overall thank you


The data itself is pretty interesting to dig into. It's a set of 28 by 28 pixel grayscale images. So you can picture the data representation there is a two-dimensional array, 28 rows, 28 columns, and only one in the third dimension, one panel or one channel. It was pulled from a larger data set that was compiled by the National Institute of Standards and Technology, NIST. And then it was also normalized for size and centered in the image. So it's good to keep in mind as we go into this that there's been a fair amount of legwork done to get the data into its nice clean current state. That's part of what makes MNIST so great to work with as a starter data set. And that's part of also what makes it a little bit less impressive if you have a model that can do well on MNIST digits. That doesn't necessarily mean it'll do well on data in general. This is very nicely cleaned up data. The rest of this description gives some small but fascinating technical details about how the data was processed and considered in making this data set. It's worth a careful read if only to get a sense for what type of work you have to do to get a data set ready for nice, convenient processing in a neural network. Another fun feature of this page is you can see as of this writing at least what various approaches have been able to achieve on this, what error rates. And for future reference, we will be working here in a convolutional net, a two-layer convolutional neural network. So comparing to some of these that have around 1% error, so one out of every 100 examples that gets the wrong label for, that's what we can compare ourselves against.


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?  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.  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


My name is Andy Godrie of Investor Intel. I'm joined today by Keith Merker of WeedMD. Thanks for stopping by. Thanks for having me, Andy. Pleasure. Welcome. So WeedMD has been in the news a lot lately. You guys recently announced your greenhouse expansion in Strathroy, Ontario. I'm curious to know what your greenhouse deal, how it differs from what your peers are doing. Wow. In a lot of ways. So thanks for asking. And again, thanks for having me here today. So what we've done in Strathroy has a number of benefits for WeedMD and our shareholders. And in a lot of ways I think stands apart from some of the other expansion strategies you've seen across the industry. Essentially what we did is we landed upon an opportunity whereby WeedMD could lease five acres of greenhouse on a state-of-the-art property. So it's a 98-acre farm, there's 14 acres currently under glass that up until quite recently was growing tomatoes, for instance, in the five acres that we're currently retrofitting. What we did is we leased out five acres from the group that owns this property and they're still operating the remaining nine acres growing tomatoes currently and peppers and eggplants. This five acres that we've taken over for a very, very, very low cost to WeedMD is currently being retrofitted. We will have that complete over the next month and a half. We've already received approvals from Health Canada for the licensing. So what that means is that the license will be issued once we are complete our security and that passes through Health Canada's hands. And we'll have plants in there early spring for harvest to be ready by late summer. So in other words, what we've done is for a very low capital investment come up with a strategy whereby we will have one of the largest production platforms under the ACMPR in production come this summer ready with harvest ready for the advent of the recreational market in Canada. So we're tremendously excited about it, one of the most capital efficient and efficient with in terms of timeline and get to market that you'll see in the industry. That's wonderful news. And with pending legalization come summertime, what's your strategy moving forward? So yeah, we've got a bunch of strategies that we're working on currently. Unfortunately, I'm not at liberty to disclose some of them to you quite yet because it hasn't been publicly disclosed. We haven't quite dotted the eyes and crossed the T's on a couple of our exciting strategies. What I can tell you is that we do have, you know, relationships and we are at the table with the various provincial agencies to provide our product. On the branding side, again, that's the part that I haven't disclosed yet and unfortunately I'm going to have to leave you in the dark today on that. But stay tuned and you're going to see some really exciting stuff coming from WeedMD. I think critically beyond that we've got, again, a very successful platform currently operating in Elmer, full licensing regime. So we'll be able to provide dry product, we'll be able to provide oil. We will also be able to provide live plants for those provinces that allow it under the legalized recreational regime. So that sets us apart a little differently than some of the other producers who don't provide that. Also our product that's coming out of the facility these days is just fantastic. So we know that regardless of whatever brand name is on this product, people will eventually realize that WeedMD is the place to go. So we'll have that going. We'll also have the production coming from the new facility. So we're very excited to be providing a quality product to the new recreational regime in Canada. So that's all good news. For the next two quarters, what can shareholders expect from WeedMD? So I think that, you know, I've touched on a few of them. One being, you know, obviously the licensing and rollout in the new facility, which is, you know, that is mission critical for us and that is what we're laser focused on quite frankly. Beyond that we're working on a number of different business development opportunities both here in Canada and internationally. So you can look to see some international exposure from the company. You can look to see further product development. We'll have our full year 2017 numbers coming out at the end of this month. And then, you know, I can tell you that our sales are tracking in the right direction. Our patient acquisition is rolling along smoothly. So we've got some great numbers that we look forward to rolling out over the next couple quarters as well, which is, you know, to us it's really important obviously and hopefully to our shareholders and investors. That's a lot of great news coming from WeedMD. We're really excited that you're able to take part in this year's seventh annual Investor Intel Summit, Bud's Batteries and Blockchain. And we look forward to seeing you there. Awesome, me too. Thanks.