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 &.
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
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).'
The pager you are in
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.
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.'
The slash search
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.
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.'
Where am I
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.
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'.
Follow the log
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.
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.'
The LESS variable
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.
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.
One habit to keep
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.
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.