less: view files page by page

Updated November 2026

less shows a file one screen at a time and lets you scroll and search in both directions. It is the default pager for manual pages and the right tool for reading logs. For short files, cat prints everything at once.

less [options] file ... command | less

Examples

less /var/log/apt/history.log
less -N script.sh            # with line numbers
less -S wide.csv             # do not wrap long lines (scroll sideways with arrows)
less +G app.log              # start at the end
less +F app.log              # follow the file as it grows (like tail -f)
journalctl -b | less         # page through command output
cat notes.txt                # print a short file
cat part1 part2 > whole      # join files
head -n 20 data.csv          # first 20 lines (see tail for the end)

Keys inside less

KeyAction
Space / bPage down / up
↓ ↑ or j kOne line down / up
g / GStart / end of the file
/textSearch forward
?textSearch backward
n / NNext / previous match
&patternShow only lines matching the pattern
FFollow new lines; Ctrl+C to stop following
-iToggle case-insensitive search
vOpen the file in your editor
hHelp
qQuit

Useful settings

Set default options in the LESS environment variable, for example in ~/.bashrc:

export LESS='-R -i -M'      # keep colours, smart case search, detailed prompt

-R displays colour codes from commands such as grep --color=always or git log correctly. Compressed logs can be read with zless (see gzip).

cat tips

more is the older pager, still present on every Unix system. It only scrolls forward on some systems, which is where the name less ("less is more") came from.