Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Less (Unix)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Usage== {{mono|less}} can be invoked with options to change its behaviour, for example, the number of lines to display on the screen. A few options vary depending on the operating system. While {{mono|less}} is displaying the file, various commands can be used to navigate through the file. These commands are based on those used by both {{mono|more}} and {{mono|[[Vi (text editor)|vi]]}}. It is also possible to search for character patterns in the file. By default, {{mono|less}} displays the contents of the file to the [[standard output]] (one screen at a time). If the file name argument is omitted, it displays the contents from [[standard input]] (usually the output of another command through a [[Pipeline (Unix)|pipe]]). If the output is redirected to anything other than a [[Computer terminal|terminal]], for example a pipe to another command, {{mono|less}} behaves like {{mono|[[cat (Unix)|cat]]}}. The "lesspipe" extension can automatically determine file types such as [[PDF]], multimedia, and [[compressed archive]]s, and automatically determines which program to launch display the file's information with, such as text from a PDF file, metadata of photos, lists of files in a compressed archive, and content of a single file in a compressed archive.<ref>{{cite web |url=https://manpages.debian.org/bullseye/less/lesspipe.1.en.html |title = lesspipe(1) β less β Debian bullseye β Debian Manpages}}</ref><ref>{{cite web |url=https://man.archlinux.org/man/lesspipe.1 |title = lesspipe(1) β Arch manual pages}}</ref> The command-[[syntax]] is: less [options] [file_name]... ===Frequently used options=== *<code>-g</code>: Highlight just the current match of any searched string. *<code>-i</code>: Search case-insensitively. *<code>-m</code>: Show more detailed prompt, including file position. *<code>-N</code>: Show line numbers (useful for viewing [[source code]]). *<code>-x3</code>: Set tabstops (the number of columns per hard tab character) to the specified number (3, in this example) (useful for viewing [[source code]]). *<code>-S</code>: Disable line wrapping ("chop long lines"). Long lines can be seen by side-scrolling. *<code>-X</code>: Leave file contents on screen when less exits. *<code>-?</code>: Show help. *<code>--follow-name</code>: Follow mode, for log files that get replaced while being viewed. ===Frequently used commands=== {| class="wikitable" border="1" |- ! Key ! Command |- ! {{Key press|Space bar}} | Next Page |- ! {{Key press|d}} | Next half Page |- ! {{Key press|b}} | Previous Page |- ! {{Key press|u}} | Previous half Page |- ! {{Key press|v}} | Edit Content |- ! {{Key press|j}} <span style="font-weight: normal;">or</span> {{Key press|Enter}} | Next Line |- ! {{Key press|k}} | Previous Line |- ! {{Key press|Home}} | Top of file |- ! {{Key press|End}} | End of file |- ! {{Key press|F}} | Follow Mode (for expanding logs or pipes). Interrupt (or from v581 {{Key press|Ctrl|X}}<ref>{{cite web|url=http://www.greenwoodsoftware.com/less/news.581.html|title=Less version 581|publisher=Greenwood Software|date=7 April 2021|access-date=31 July 2023}}</ref>) to abort. |- ! {{Key press|g}} <span style="font-weight: normal;">or</span> {{Key press|<}} | First Line |- ! {{Key press|G}} <span style="font-weight: normal;">or</span> {{Key press|>}} | Last Line |- ! <code>{{angbr|n}}</code>{{Key press|G}} | Line <code>{{angbr|n}}</code> |- ! {{Key press|/}}<code>{{angbr|text}}</code> | Forward Search for <code>{{angbr|text}}</code>. Text is interpreted as a [[Regular expression|regex]]. |- ! {{Key press|?}}<code>{{angbr|text}}</code> | Backward Search like {{Key press|/}} |- ! {{Key press|&}}<code>{{angbr|text}}</code> | [[grep]] like filter |- ! {{Key press|n}} | Next Search Match |- ! {{Key press|N}} | Previous Search Match |- ! {{Key press|Esc}}{{Key press|u}} | Turn off Match Highlighting (see <code>-g</code> command line option) |- ! {{Key press|-}}<code>{{angbr|c}}</code> | Toggle option <code>{{angbr|c}}</code>, e.g., {{Key press|-}}{{Key press|i}} toggles option to match case in searches |- ! {{Key press|m}}<code>{{angbr|c}}</code> | Set Mark <code>{{angbr|c}}</code> |- ! {{Key press|'}}<code>{{angbr|c}}</code> | Go to Mark <code>{{angbr|c}}</code> |- ! {{Key press|{{=}}}} <span style="font-weight: normal;">or</span> {{Key press|Ctrl|G}} | File information |- ! {{Key press|:}}{{Key press|n}} | Next file |- ! {{Key press|:}}{{Key press|p}} | Previous file |- ! {{Key press|h}} | Help. This is presented with <code>less</code>, {{Key press|q}} to quit. |- ! {{Key press|q}} | Quit |}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)