← All 103 books less, one lesson per page
One lesson per page

less, one lesson per page

Thirty lessons for the terminal pager every SSH session lands in: movement keys, the slash search and n/N, g/G jumps, marks with m and the single quote, the = status line, -N line numbers, -S chop against wrap, -F quit-if-one-screen, F follow mode for logs, -R colour, the LESS and LESSSECURE environment keys, shell escapes with !, and filtering with &.


Steve Hodgkiss 6 lessons

A diagram, the map, and one thing to try this week. That's a page.

less, one lesson per page

Thirty lessons for the terminal pager every SSH session lands in: movement keys, the slash search and n/N, g/G jumps, marks with m and the single quote, the = status line, -N line numbers, -S chop against wrap, -F quit-if-one-screen, F follow mode for logs, -R colour, the LESS and LESSSECURE environment keys, shell escapes with !, and filtering with &.


Set in Space Grotesk, Inter and JetBrains Mono (SIL Open Font License).

Every fact in this book is as the official source states it, fetched and read during this build: the less(1) manual of the Linux man-pages project at man7.org, cross-checked against the local system less(1) manual (less 590); behaviour noted as differing on other versions is flagged on the page. Demand evidence from live beginner threads, reconfirmed at dispatch; no facts are sourced from tutorials, howtogeek, linuxize, Reddit or StackExchange. An independent guide, not affiliated with or endorsed by the GNU project or the less maintainer.

Your purchase is for personal use only. You do not have redistribution rights: please do not share, resell, or republish this book or its pages.

© 2026 Steve Hodgkiss. All rights reserved. Personal use only; no redistribution rights.

Edition 1.0 · stevehodgkiss.net

Contents

Contents


Part 1 · In the pager
The pager you are in4
Part 2 · Searching
The slash search5
Part 3 · Marks and position
Where am I6
Part 4 · Logs
Follow the log7
Part 5 · Environment
The LESS variable8
Part 6 · Habits
One habit to keep9

Per the less(1) manual: 'less - display the contents of a file in a terminal', and 'Less is a program similar to more(1), but it has many more features. Less does not have to read the entire input file before starting, so with large input files it starts up faster than text editors like vi(1).'

terminal pager · No. 01
In the pager

The pager you are in

You are already here

the screen every SSH session lands inless app.log17:02:11 worker-3 job 4471 done17:02:12 worker-1 job 4472 start17:02:14 worker-2 job 4473 done:(the only hint a pager is running)who pipes into less:man pages, by defaultgit log, on a terminalany long coloured outputand it starts before thewhole file is even readyou did not choose this screen; this book teaches it

You have used less hundreds of times without deciding to. Per less(1), it displays the contents of a file in a terminal, and man pages, git log and most coloured command output are piped into it by default.

The manual's other claim matters for big files: less does not have to read the entire input file before starting, so it opens a multi-gigabyte log instantly while an editor would still be counting lines.

You are already here. This book makes the screen you land in a place you can work.

TRY IT THIS WEEK

This week, notice every time less appears: run man less, git log, and any long command output. Count the landings; each one is a lesson in use.

Per less(1): '/pattern: Search forward in the file for the N-th line containing the pattern. The pattern is a regular expression, as recognized by the regular expression library supplied by your system. By default, searching is case-sensitive; the -i option can be used to change this.'

terminal pager · No. 02
Searching

The slash search

Find the word

slash, pattern, ENTER, jumpapp.log17:44:01 auth: accepted user bob17:44:19 auth: failed user root ~~~~~/failedit like a command line, ENTER commitsper less(1): the patternis a regular expression,understood by yoursystem's regex library;case-sensitive by default(-i changes that, two pages on)a file you can search is a database you can query

The one feature people stay in less for. Per less(1), /pattern searches forward for the N-th line containing the pattern, and the pattern is a regular expression, understood by your system's regex library.

You type the pattern at the bottom of the screen, edit it with the arrow keys like a command line, and ENTER commits. Case matters by default; the next pages change that.

Slash is why less replaced more. A file you can search is a database you can query.

TRY IT THIS WEEK

Search a real log this week: open it in less, press /, type an error word, land. Then search for a regex fragment like 'err.or' and watch it match more.

Per less(1): '= or ^G or :f: Prints some information about the file being viewed, including its name and the line number and byte offset of the bottom line being displayed. If possible, it also prints the length of the file, the number of lines in the file and the percent of the file above the last displayed line.'

terminal pager · No. 03
Marks and position

Where am I

= answers

= prints the position; one key, the whole answerafter = or ^G or :fapp.log lines 18368-18407/36012 byte 2419088/473321051% (line numbers and byte offset of the bottom line)file name, file length, line count, percent: all of it=the number you paste intothe bug report, not 'near the middle'^G works too:f as wellmove, then ask: the pager always knows where you are

The question every session asks, answered by one key. Per less(1), = or ^G or :f prints the file's name, the line number and byte offset of the bottom displayed line, and, when possible, the length, the number of lines and the percent through the file.

This is the number you paste into a bug report: not 'somewhere near the middle' but line 18407 of 36012, 51 percent.

Move, then =. The pager tells you exactly where you stand, if you ask.

TRY IT THIS WEEK

Make = a reflex this week: after every jump and every search, press it once. Read the percent out loud until it is a habit.

Per less(1): 'F: Scroll forward, and keep trying to read when the end of file is reached. Normally this command would be used when already at the end of the file. It is a way to monitor the tail of a file which is growing while it is being viewed. (The behavior is similar to the tail -f command.)' Also the + argument: '+G tells less to start at the end of the file rather than the beginning'.

terminal pager · No. 04
Logs

Follow the log

F, or +F to start

F: scroll forward, keep reading as the file grows17:58:04 req done17:58:05 req done17:58:06 req done18:00:01 req new(arriving live)Fmonitor the tail of agrowing file; the manualitself says 'similar tothe tail -f command'+G starts at the endpre-positioned forfresh rows onlytail -f watches; less F watches, then investigates

Per less(1), F scrolls forward and keeps trying to read when the end of file is reached: 'a way to monitor the tail of a file which is growing while it is being viewed', behaviour the manual itself compares to tail -f.

The difference is everything else: when something interesting scrolls past, you are already in less, with /, marks and = one key away. Start pre-positioned with +G, which tells less to begin at the end of the file.

tail -f watches. less F watches and then investigates, without restarting anything.

TRY IT THIS WEEK

Watch one service's log this week with less +G then F. When something odd flows past, interrupt and search backwards for its first occurrence.

Per less(1): 'Options are also taken from the environment variable LESS. For example, to avoid typing less -options ... each time less is invoked, you might tell csh: setenv LESS "-options" or if you use sh: LESS="-options"; export LESS'; 'The environment variable is parsed before the command line, so command line options override the LESS environment variable.'

terminal pager · No. 05
Environment

The LESS variable

Options at birth

LESS holds the options every invocation inherits~/.bashrcLESS='-R -m -N'every less, already yourscolour, percent and numbers by defaultprecedence, per less(1): the variable is parsed before the commandline, so command line options override it; -+ resets an inherited optionstate your opinion once; every pager you land in arrives your way

Your defaults belong in the environment. Per less(1), options are also taken from the LESS variable: LESS="-options" then export, in the shell's own words. A classic value is -R -m -N, colour, percent and numbers by default.

Precedence is stated plainly: the variable is parsed before the command line, so command line options override it, and -+ resets an inherited option entirely.

Set the opinion once in your rc file. Every pager you land in, chosen or not, arrives your way.

TRY IT THIS WEEK

Write your LESS line this week: pick two or three flags from this book, export LESS in your rc, open a new shell and confirm.

Per the less(1) manual's COMMANDS section: / searches forward, n and N repeat and reverse; g and G jump by line; m marks and the single quote returns; = prints the file name, line number, byte offset and percent; F follows a growing file; the + argument gives an initial command; -N, -S, -R, -m, -F and -X change the view; the LESS variable holds default options and LESSSECURE constrains them; ! escapes to a shell and :n walks the file list.

terminal pager · No. 06
Habits

One habit to keep

Slash, jump, ask

search, position, decide: the loop is the skill/ then nfind every occurrenceg G =know where you areF or qwatch on, or leavemarks pin it, filters narrow it, -m and -N instrument it, LESS defaults itbut the loop alone is the skillthirty lessons, one loop: that is less, handled

The whole book in one loop. / then n: find every occurrence. g, G and =: know exactly where you are. Then F to keep watching, or q to leave with the position in hand.

Everything else deepens the loop: marks pin it, & narrows it, -m and -N instrument it, LESS makes it your default. But the loop alone is the skill: search, position, decide.

Thirty lessons, one loop. That is less, handled.

TRY IT THIS WEEK

Teach the loop to someone this week: slash to find, G and = to orient, F or q to finish. If you can teach it, it is yours.

Index

Index


Follow the log7
One habit to keep9
The LESS variable8
The pager you are in4
The slash search5
Where am I6