Welcome to the Linux command line Tutorials,
In this blog we will going to learn how we can use less command in Linux and what are the functions performed by the less command.
Lets see what is less command and why we use less command, Less command is used to read files, search anything in content of file or search any pattern or any word, So,lets see how we can do it.
First, Open Terminal Ctrl+Alt+t .
Suppose a file contain data or content and if we want to read that content then we use cat command as we learn earlier but problem is occurred when data or content is very large in size and terminal does not allow as to read data from the starting, to resolve such type of problem we will use less command in this way :
less [file_name]
1. Now terminal shows you content up to it allows to display, and if you want to see more content you can use down key which will move content by one line downward and same for upward key also.
2. Now, if you want to see content page by page just hit space bar key for downward direction.
3. If you want to see page by page content in upward direction use capital B or simply b.
4. If you want to go at the end of the file you just press capital G like shift+G key.
5. If you want to go at the starting of the page you should type 1 and G or only small g .
6. Now another feature of less command i.e., searching, If you want to search any word or pattern from the up to down we will use / [searching_word] and press enter. It will highlight that word and then press n to continuous searching for that word in downward direction.
At the last it will say pattern does not found.
7. Now some times you may want to search word from downward to upward direction then we will use ? [Searching_word] and press enter.
8. And at last if you want to quit from less command you simply press q key for exit.
For more information about less command you can use command:
man less
For any query and suggestions you may contact with me or you may put comment in comment box.
Thank You.
Contact Details: Phone: +91-8208826234
E-mail: shivampawar1038@gmail.com
In this blog we will going to learn how we can use less command in Linux and what are the functions performed by the less command.
Lets see what is less command and why we use less command, Less command is used to read files, search anything in content of file or search any pattern or any word, So,lets see how we can do it.
First, Open Terminal Ctrl+Alt+t .
Suppose a file contain data or content and if we want to read that content then we use cat command as we learn earlier but problem is occurred when data or content is very large in size and terminal does not allow as to read data from the starting, to resolve such type of problem we will use less command in this way :
less [file_name]
1. Now terminal shows you content up to it allows to display, and if you want to see more content you can use down key which will move content by one line downward and same for upward key also.
2. Now, if you want to see content page by page just hit space bar key for downward direction.
3. If you want to see page by page content in upward direction use capital B or simply b.
4. If you want to go at the end of the file you just press capital G like shift+G key.
5. If you want to go at the starting of the page you should type 1 and G or only small g .
6. Now another feature of less command i.e., searching, If you want to search any word or pattern from the up to down we will use / [searching_word] and press enter. It will highlight that word and then press n to continuous searching for that word in downward direction.
At the last it will say pattern does not found.
7. Now some times you may want to search word from downward to upward direction then we will use ? [Searching_word] and press enter.
8. And at last if you want to quit from less command you simply press q key for exit.
For more information about less command you can use command:
man less
For any query and suggestions you may contact with me or you may put comment in comment box.
Thank You.
Contact Details: Phone: +91-8208826234
E-mail: shivampawar1038@gmail.com
Comments
Post a Comment