Linuxlab

less command in Linux: page through a file

Updated July 3, 2026

The less command shows a file a page at a time, without reading the whole file into memory.

Syntax

less file

Common cases

less /var/log/syslog   # page through a file
journalctl | less      # take input from a pipeline
# inside less:
#   space / b   - page forward / back
#   /pattern    - search, n for the next match
#   q           - quit

How it works: why less, not cat

cat on a large file pushes the start off the screen, which you cannot get back. less reads the file lazily as you scroll, so it opens even gigabyte logs instantly and uses little memory. The name is a pun on the older pager more: less scrolls both ways and searches, while more only went forward. On quit less leaves no file on the screen.

Used in

You need this in the lesson Reading text. The theory is the chapter Reading and editing text.

See also

cat, head, tail, The file command.

Try it

Open the sandbox: a real throwaway Linux terminal in your browser. Run the commands above by hand - the container is deleted when you leave.