Software & Apps Linux 44 44 people found this article helpful Everything You Need to Know About the Less Command Move about files in the shell with this useful command by Gary Newell Writer Gary Newell was a freelance contributor, application developer, and software tester with 20+ years in IT, working on Linux, UNIX, and Windows. our editorial process Gary Newell Updated on November 11, 2019 reviewed by Chris Selph Lifewire Tech Review Board Member Chris Selph is a CompTIA-certified technology and vocational IT teacher. He also serves as network & server administrator and performs computer maintenance and repair for numerous clients. our review board Article reviewed on May 16, 2020 Chris Selph Lifewire Linux Switching from Windows Tweet Share Email The less command is a more powerful version of the more command that displays information to the terminal one page at a time. Many of the switches are the same as the ones used with the more command, but there are lots of extra ones available as well. How to Use the 'less' Command View any text file using the less command simply by typing the following into a terminal window: less filename If there are more lines in the file than space on the screen then a single colon (:) will appear at the bottom and you will have a number of options to move forward through the file. The less command works with output piped through another command. For example: ps -ef | less The above command will show a list of running processes, one page at a time. Press either the space bar or the F key to scroll forward. Changing the Number of Scrolled Lines By default, the less command scrolls a single page at a time. Change the number of lines that scroll when you press the space and F key by pressing the number immediately before pressing the key. For example, enter 10 followed by either the space or F key to advance the screen by 10 lines. To set this value as default, enter the number followed by the Z key. To scroll one line at a time press either the Enter, e or j keys. Change the default so that it scrolls a specified number of lines by entering a number before the specified keys. For example, enter 5 followed by the e key will make the screen scroll 5 lines every time. To scroll back up the list you can use the b key. Unlike the more command, this can work with both files and piped output. You can also scroll horizontally using the left and right arrow keys. Redisplay the Output Use a lowercase r to repaint the screen or an uppercase R to repaint the screen, discarding any output that has been buffered. Move to a Specific Position in a File To return to the beginning of the output, press lowercase g and to go to the end press uppercase G. To go to a specific line, enter a number before pressing the g or G keys. Searching for a Pattern Locate text within the output using the forward-slash key followed by the text you wish to search or a regular expression. For example, /"hello world" will find hello world. To search up the file, replace the forward slash with a question mark. For example, ?"hello world" will find hello world previously output to the screen. How to Exit Less To exit the less command, press q. Less supports quite a few switches. Run less --help or man less for additional information.