TL;DR
Tim Chase collected a set of practical tips for the less pager, covering multi-file workflows, navigation, searching, filtering and small productivity tricks. The notes condense commands and interactive keystrokes that can make inspecting files and logs more efficient without leaving less.
What happened
A developer aggregated a series of hands-on tips for the command-line pager less, originally shared in a Reddit discussion, and published them as a short guide. The notes show how to open files directly with less (including multiple filenames and globs), add files to the current session with :e, and move between files using :n, :p and :x. There are quick navigational techniques such as jumping to a line with <count>G or to a percentage offset with <count>%, plus search modifiers to control scope and direction across files. The author also documents filtering displayed lines with &, creating bookmarks (m<letter> and '<letter>), matching bracket pairs by typing the bracket character, and toggling boolean less options from inside the pager with -<option>. Additional tips cover running shell commands with !, saving stdin output to a file with o/O, invoking your editor with v, and setting default flags via the LESS environment variable.
Why it matters
- Speeds up reading and cross-referencing multiple files without leaving the pager.
- Helps inspect large logs or long command output by filtering and targeted searches.
- Interactive option toggles avoid re-running long commands just to change view settings.
- Bookmarks and bracket matching reduce manual scrolling and improve navigation efficiency.
Key facts
- Invoke less directly with filenames, e.g. less README.txt file.c *.md, not only via a pipeline.
- Add a file to the argument list at runtime with :e filename and remove the current file with :d.
- Move between files with :n (next), :p (previous) and 😡 (rewind to first file).
- Jump to a line with <count>G (3141G goes to line 3141) or to a percent offset with <count>%.
- Search modifiers include ! (next non-matching), * (search across files), @ (rewind then search), and @* (rewind then search across files); combine with / or ?.
- Filter displayed lines like grep using &pattern and invert with &!pattern.
- Set bookmarks using m<letter> and return with '<letter>; marks persist across open files.
- Type a bracket character present at the top or bottom line to jump to its match; custom pairs can be defined with Alt+Ctrl+f/b.
- Toggle boolean options inside less by typing -<option> (examples: -S for line-wrapping, -R for ANSI colors, -N/-n for line numbers).
- Run external commands from less with !command; write collected stdin content to a file with o (append) or O (overwrite), and open the current file in $VISUAL with v.
What to watch next
- not confirmed in the source
- not confirmed in the source
Quick glossary
- less: A terminal pager program used to view (but not edit) text one screen at a time, with interactive navigation and search.
- pager: A command-line tool that displays text output page by page, allowing the user to scroll and search within the content.
- pipeline: A shell construct that passes the output of one command as input to another, commonly using the | character.
- stdin: Standard input stream; many commands read data from stdin when invoked without file arguments.
- bookmark (mark): A named position within a document saved for quick return; in less it is set with m<letter> and recalled with '<letter>.
Reader FAQ
Can less open multiple files at once?
Yes — provide multiple filenames or globs on the command line, e.g., less file1 file2 *.txt; you can also add files later with :e.
How do I search across all files opened in less?
Use search modifiers such as /@*pattern to rewind to the first file and search across files from there.
Can I toggle options like line-wrapping without restarting less?
Yes — type – followed by the option name inside less (for example -S to change line-wrapping).
Is it possible to save stdin output viewed in less to a file?
Yes — the o command appends the collected stdin output to a file (O overwrites).
Does less support tags like vi/vim?
Less does provide tag support (e.g., for ctags), but further usage details are not provided in the source.
Assorted less(1) tips Tim Chase 2025-11-11 "word to your moms, I came to drop bombs, I've got more less tips than the Bible's got Psalms." In a recent discussion on…
Sources
- Assorted less(1) tips
- command line – List of useful `less` functions
- Less Cheatsheet
- Unix Less Command: 10 Tips for Effective Navigation
Related posts
- Inside Netflix’s Simian Army: Automated chaos tests for cloud resilience
- BYD Overtakes Tesla as World’s Largest EV Maker After 2025 Market Shift
- Assorted less(1) tips — practical commands and navigation tricks