File Viewing & Editing

less

View file contents interactively with forward and backward navigation.

Synopsis

syntax
less [OPTION]... [FILE]...

Examples

Browse a log file interactively
less /var/log/syslog
View with line numbers
less -N script.sh
Pipe colored output for browsing
command | less -R
Live-follow a file (Ctrl-C to stop)
less +F /var/log/auth.log

Common options

FlagDescription
-NShow line numbers
-SChop long lines instead of wrapping
-iCase-insensitive search
-RDisplay ANSI color escape sequences
+FFollow mode like tail -f

About less

The `less` command view file contents interactively with forward and backward navigation. Text viewing and editing commands are fundamental tools in any Linux user's toolkit.

Linux treats almost everything as a file, so the ability to quickly inspect, filter, transform, and edit file contents from the command line is critical. These commands are regularly combined with pipes and redirects to build powerful data-processing pipelines.

The command accepts 5 commonly used flags shown above, though the full set of options is available in the man page (`man less`). The 4 examples on this page cover typical real-world usage patterns that you can copy and adapt for your own workflows.

Related commands

More File Viewing & Editing Commands

Other commands in the File Viewing & Editing category

Related tools