less Command in Linux




In this blog we will learn about less command .less command we can use to read the files or if you want to search some thing inside the file something like patterns or some word you can use less command conveniently to read or search in the file .First of all lets open our terminal , We can press ctrl+alt+ t to do this .

1.Now if you have a very big file , and use cat command for the content , now once you come to the bottom , after certain level you cannot again go back to top and read .In such cases less command is quite useful . The Basic command look like : $ less filename .

It will show you the content of the file from the starting and will show you some text until the terminal allows it to show it and if you go on to see the content of the file more you can hit the down arrow key so down arrow key to go one line down at a time and if you hit up arrow then you can read up or you can browse over the file. If you want to go through the file page by page what you can use is you can use a space key to navigate file page by page . If you want to go upwards page by page you can press b and you will go one page up at a time . Now if you want to go at the end of the file you can just press Shift + g and you browse to the end of your text file . Now if you want to go at the top press g it will browse me to the top .

You can press ctrl+z to quit .

2.Now you want to search a word , You can do this using ‘/’ . Command : /(word) .

3.Now sometimes you may want to search from down to up and for this you can use this question mark for searching from down to up and then you can you know give your keyword which you are looking for  .Command : ?(word)

 And then when you press n it will go through the text file and highlight the word from down to up .

if you want to knowmore about less you can just write man less .


Partner Sites

VideoToGifs.com

EasyOnlineConverter.com

SqliteTutorials.com





Be the first to comment

Leave a Reply

Your email address will not be published.


*