Skip to main content

Linux Command Line Tutorial For Beginners - less command

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

Comments

Popular posts from this blog

Linux Command Line Tutorial For Beginners - Introduction

Hi Friends, Welcome to Blog , Welcome to Linux . Now first question you may ask yourself why we should learn command line, even if we have GUI ? So, Simple answer is that GUI ( Graphical User Interface ) is helpful in many task but not useful in all task, and when you learn command, you will observe that you are able to do your day to day task or any task related to programming much faster that you can do with GUI . By using command you can able to see what happening in a background when you given a something task. Before dive into the world of Linux you should know two terms i.e., Shell and Terminal. Now what is Shell? Shell is a simply a program that takes inputs from the keyboard and gives that to the operating system to perform task.It is also called as CLI ( Command Line Interface ), Now the second term is Terminal, terminal is tool which is used to pass a shell command, this is a program that open up a window and lets interacts with shell. There are different operating...

Linux Command Line Tutorial For Beginners - ls command

ls is a Linux shell command that lists directory contents which may be files or directories. First of all lets open Terminal, Alt+Ctrl+T ls command uses following syntax:          ls [option] [file or directory name] if we give simple ls command it will show us all directories and files present in home directory, as when we open terminal by default we are in home directory. Now if we want to see what is in Downloads directory then we simply give command as:                          ls Downloads Note one thing i.e., command line is case sensitive so we should write name of directory or file as it is. In same way you can able to see contents of any directory. If we want to see content of root directory then we will write command as: As we know / is called as root directory.      ...