less Page through a file one screen at a time
Opens a file or command output in a scrollable viewer. You can move up and down, and search, without the text scrolling off the screen. Use it for any file or output that is longer than one screen.
Synopsis
less [OPTION]... [FILE]...
command | less [OPTION]...
Common options
| Option or form | What it does |
|---|---|
-N | Show line numbers down the left side |
-S | Cut long lines off at the screen edge instead of wrapping them. Use the arrow keys to scroll sideways |
-i | Ignore case when searching, unless the search text has a capital letter |
-I | Ignore case when searching, even if the search text has capital letters |
-R | Show ANSI colour codes as colours instead of as raw characters. Needed to see coloured output piped in |
-F | Quit straight away if the whole input fits on one screen |
-X | Do not clear the screen on exit, so the text stays in your terminal |
-p pattern | Open the file at the first match of pattern |
Examples
less /var/log/system.log
less -N app.log
ls -la /usr/bin | less
grep --color=always -rn error /var/log | less -R
less -S data.csv
less -p timeout app.log
Notes
- less is interactive, so none of these examples can be run automatically. Keys inside less: Space or f for next page, b for previous page, g for the top, G for the bottom, q to quit.
- To search, type / then the text and press Enter. Press n for the next match and N for the previous one. Use ? instead of / to search backwards.
- Press F inside less to follow the end of the file, like tail -f. Press Ctrl-C to stop following and move around again. less +F file starts in this mode.
- less only reads. It cannot change the file. When the output is short and you want it printed, use cat, head or tail instead.
- less is the modern successor to more, and on macOS the more command is a version of less. Man pages and git use less as their pager by default.
See also
Last reviewed 2026-10-07.