More people should use `less`

In the world of Linux command-line tools, there’s an old joke: “Why should more people use less? Because less is more!” This pun isn’t just a play on words—it’s a nod to one of the most underrated utilities in a sysadmin or developer’s toolkit. While many users default to commands like cat or more to view files, the humble less command offers a superior experience for reading, navigating, and analyzing text. Let’s dive into why less deserves a prime spot in your workflow.
What is less?
less is a terminal pager designed to view and navigate through files or command output efficiently. Introduced in 1984 as a successor to more, it earned its name because it does “more” by requiring “less” effort (and because, unlike more, it allows backward movement in files). While more was limited to forward-only scrolling, less broke boundaries by enabling bidirectional navigation, robust searching, and seamless handling of massive files.
Key features of less
Scroll Freely, Forward and Backward
Withless, you’re not stuck moving in one direction. Use the arrow keys (or vim motion keys if you prefer),Page Up/Page Down(orfandblike vim again), or even the spacebar to scroll. Want to jump to the end? PressG. Return to the top? Pressg.Search Like a Pro
Tap/to start a forward search or?for a backward search.lesshighlights matches and lets you cycle through them withn(next match) orN(previous match).Handle Massive Files with Ease
Unlike text editors that load entire files into memory,lessopens files incrementally. This makes it perfect for log files that are gigabytes in size—no freezing or lag.Follow Real-Time Updates
Watching a growing log file? PressFto enter “follow mode,” andlesswill tail the file in real time, similar totail -f. Exit follow mode withCtrl+C.Line Numbers and Wrapping
Toggle line numbers with-N(e.g.,less -N file.txtor type-Nafter opening the file) or disable line wrapping with-Sto avoid messy output.Show colors from your logs
If you open a file with colored strings, then you can show those colors using the
-Roption.Integrate with Pipelines
Pipe output from commands likegrep,awk, orjournalctldirectly intolessfor easier analysis:grep "ERROR" app.log | less
Why ditch more for less?
The original more command is still around, but it lacks many of less’s features. For example:
No backward scrolling: Once you scroll past a page in
more, you can’t go back.Limited navigation:
morelacks search highlights, jump-to-end shortcuts, or follow mode.Basic functionality: It’s just… less.
Even the manual page for more admits its shortcomings, often stating, “more has fewer features than less.”
Getting started with less
Most Linux and macOS systems include less by default.
But, in case you don’t have it readily installed it is usually available in your OS’s package manager. In Ubuntu, you can run this to install less
sudo apt install less
To open a file:
less filename.txt
Essential Commands:
q: Quit./pattern: Search for “pattern.”:nand:p: Navigate between multiple files (if opened withless file1 file2).-i: Ignore case in searches (useless -i file).v: Open the file in your default text editor (e.g., Vim).
Advanced tips
View Compressed Files
Uselesswith tools likezlessto view compressed files without manual extraction.Customize Display
Set environment variables in your shell config (e.g.,~/.bashrc) to tweakless’s behavior. For example:export LESS="-i -N -S -R"This ignores case in searches, enables line numbers, chops long lines, and shows colors.
Avoid Binary Files
If you accidentally open a binary,lesswill warn you. Pressqto exit, then use tools likestringsorxxdinstead.
Conclusion
In an era of bloated GUIs, less remains a lightweight, powerful tool for anyone working in the terminal. Its versatility, speed, and intuitive navigation make it indispensable for debugging logs, reading documentation, or exploring data. So next time you reflexively type cat or more, give less a try. After all, why settle for “more” when you can have… less?
Pro Tip: Type man less to view its manual—ironically, you’ll be reading it in less itself. Now that’s meta!



