Linux Terminal Command: less

The less command is an essential tool in File Manipulation & Viewing. In this tutorial, we will explore what less does, look at everyday examples, and cover advanced options to supercharge your command-line workflow.


Concept & Explanation

The less command opens files page-by-page. Unlike more, it does not need to load the entire file into memory before starting, which makes it extremely fast on large files.


Common Options & Syntax

less [options] [arguments]

Here are the most common flags used with less:


1. Interactive Example (Simple)

Here is how most people run the command:

# Example
less syslog.log

What it does: Opens ‘syslog.log’ in a scrollable viewer.


2. Power-User Example (Advanced)

For scripting and advanced diagnostics, use this configuration:

# Advanced
less +F /var/log/nginx/access.log

What it does: Opens the log file and enters ‘forward’ mode (like tail -f), automatically updating when new content is written. Press Ctrl+C to return to scroll mode.


⚙️ Warning & Common Pitfalls

[!WARNING] Inside less, you navigate with Vim keys (j, k, g, G) and search with /. Remember to press q to exit the pager.


Here are some related posts on cli_tty1 you might want to check out: