Skip to content

less command

Page through long files and command output.

On this page

Syntax

less [options] [file]

Provided by the less package. Run man less for the full manual.

Common options

OptionWhat it does
-NShow line numbers
-SDon't wrap long lines
-iCase-insensitive search
+FFollow the file like tail -f
-RShow colours from command output

Examples

  1. Open a file

    less /var/log/syslog
  2. Show line numbers

    less -N app.log
  3. Page through command output

    journalctl | less
  4. Follow a growing log (Ctrl+C to stop, F to resume)

    less +F /var/log/nginx/access.log
  5. Keep colours

    grep --color=always error app.log | less -R

Tips

  • Inside less: /word searches forward, n next match, G end of file, g start, q quit.

← All Linux commands · Suggest a fix

Back to top