Software & Apps Linux 46 46 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 July 05, 2020 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 Tweet Share Email Linux Switching from Windows 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 you use with the more command, but lots of extra ones are available as well. How to Use the 'less' Command View any text file using the less command by typing the following into a terminal window: less filename If the file has more lines than space on the screen, a single colon (:) will appear at the bottom, and you'll 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 before the e key to make the screen scroll 5 lines every time. To scroll back up the list, use the b key. Unlike the more command, scrolling works 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 you've buffered. Move to a Specific Position in a File To return to the beginning of the output, press lowercase g. 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. Was this page helpful? Thanks for letting us know! Get the Latest Tech News Delivered Every Day Email Address Sign up There was an error. Please try again. You're in! Thanks for signing up. There was an error. Please try again. Thank you for signing up. Tell us why! Other Not enough details Hard to understand Submit