less
View file contents interactively with forward and backward navigation.
Synopsis
less [OPTION]... [FILE]...
Examples
less /var/log/syslog
less -N script.sh
command | less -R
less +F /var/log/auth.log
Common options
| Flag | Description |
|---|---|
| -N | Show line numbers |
| -S | Chop long lines instead of wrapping |
| -i | Case-insensitive search |
| -R | Display ANSI color escape sequences |
| +F | Follow 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