In Linux, working through the terminal is often the most efficient way to manage systems, view logs, or interact with files. One command that every user — beginner or experienced — should know is less. The less command is a terminal pager used to view the content of text files one screen at a time. It’s especially useful when you need to read large files or outputs from other commands without overwhelming your screen.
When you open a file with less, it doesn’t load the entire file into memory. Instead, it streams the content as you scroll, which makes it very fast and lightweight — even with log files that are several megabytes in size. Unlike text editors like nano or vim, less is non-editable — it’s strictly for reading. This means you can safely open configuration files, logs, or any text file without the risk of accidentally modifying them.
Example:
This will open the system authentication log in less, allowing you to navigate through it with simple key commands.
Key | Function |
---|---|
Space | Scroll forward one page |
b | Scroll backward one page |
Enter | Scroll down one line |
g | Go to the beginning of the file |
G | Jump to the end of the file |
/pattern | Search forward for a keyword (e.g. /error) |
n / N | Repeat search (next/previous match) |
q | Exit less |
These commands make it easy to review logs, search for specific entries, or simply browse through structured files.
Quickly check SSH settings without accidentally changing anything.
Then press /fail to search for lines containing “fail”.
View the full output of the ps aux command without it scrolling off the screen.
-N — Show line numbers:
-S — Chop long lines instead of wrapping them:
+G — Open file and jump straight to the end:
These options enhance how you interact with files in various contexts — from debugging errors to verifying recent log entries.
You can read .gz files without extracting them using zless, a variation of less:
It behaves exactly like less, but works with compressed content — ideal for archived logs.
The less command is one of the simplest yet most practical tools in any Linux user’s toolkit. Whether you’re managing a VPS, analyzing logs, or just navigating through system files, less helps you read comfortably, safely, and efficiently. It doesn’t edit files, doesn’t consume extra memory, and gives you full control over how you view data — one page at a time.