Software & Apps Linux Example Uses of the Linux "less" Command Less gets you more—more context, that is by Juergen Haas Writer Former Lifewire writer Juergen Haas is a software developer, data scientist, and a fan of the Linux operating system. our editorial process Juergen Haas Updated on December 02, 2020 Tweet Share Email Jorg Greuel / Getty Images Linux Switching from Windows The Linux "less" command displays any file and any section of a file. It comes with all major Linux distributions and does not require any setup or installation. It does not require the whole file to be loaded into memory to view parts of it, so it starts up faster on large files than editors do. And unlike the program "more," which can only scroll forward, less can scroll back as well. To get started, simply type less filename in a shell. The program loads the beginning of the file, displaying as many lines as the screen can hold. For example: less table1 After the program loads a particular file, use the page-up and page-down keys to move through the file's contents a full screen at a time. The down-arrow key scrolls one line down, while the up-arrow key scrolls one line up. Moving to a Specific Position in a File Jump to any line in the file by typing in the line number followed by g. To go the beginning of the file, type a lowercase g without a number. To go the end of the file, type an uppercase G without a number. Jump to locations of a file based on the percentage distance into the file. Type a percentage for how far into the file you want to move, such as "50" for halfway, then press the P or % key. The percentage number may be a decimal number, such as 50.75. Searching for a Pattern Use less to search for a specific word, number, or sequence of characters by typing / followed by the search string or regular expression. For example: /"task 2" This command will locate task 2 within the file. 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