# info > less

---
type: CommandReference
command: less
mode: man
section: 1
source: man-pages
---

## Quick Reference

- `less file` — view a file
- `less -N file` — display line numbers
- `less -S file` — chop long lines (no wrap)
- `less +G file` — start at end of file
- `less -p pattern file` — start at first occurrence of pattern
- `/pattern` — search forward
- `n` — repeat search forward
- `q` — exit

## Name

less - opposite of more

## Synopsis

less -?
less --help
less -V
less --version
less [-[+]aABcCdeEfFgGiIJKLmMnNqQrRsSuUVwWX~]
     [-b space] [-h lines] [-j line] [-k keyfile]
     [-{oO} logfile] [-p pattern] [-P prompt] [-t tag]
     [-T tagsfile] [-x tab,...] [-y lines] [-[z] lines]
     [-# shift] [+[+]cmd] [--] [filename]...
## Options

### Scrolling & Navigation

- `-z n` — set window size to N lines
- `-j n` — position target line at screen line N
- `-# n` — horizontal scroll amount (default half screen width)
- `-c` — repaint from top line down
- `-s` — squeeze consecutive blank lines into one
- `-S` — chop long lines (no wrap)

### Searching

- `-i` — case-insensitive search (ignored if pattern has uppercase)
- `-I` — case-insensitive search even if pattern has uppercase
- `-g` — highlight only the particular match, not all matches
- `-G` — suppress all search highlighting
- `-a` — forward search starts at bottom of screen (skip displayed lines)
- `-A` — all forward searches start after target line

### Display

- `-N` — display line numbers at start of each line
- `-M` — verbose prompt (like more)
- `-m` — medium prompt (percent into file)
- `-r` — display raw control characters (not recommended)
- `-R` — display ANSI color escape sequences in raw form
- `-~` — display blank lines after end of file instead of tildes
- `-J` — display status column with search matches and marks
- `-w` — highlight first new line after forward page movement
- `-W` — highlight first new line after any forward movement

### File Handling

- `-e` — exit on second end-of-file
- `-E` — exit on first end-of-file
- `-F` — exit if entire file fits on first screen
- `-f` — force open non-regular files (directories, devices)
- `-o file` — copy input to file (pipe only)
- `-O file` — like -o but overwrite without confirmation
- `-p pattern` — start at first occurrence of pattern
- `-t tag` — go to tag (requires tags file)
- `-T tagsfile` — specify tags file
- `-X` — do not send termcap init/deinit strings

### Buffers & Performance

- `-b n` — buffer size in KB per file (default 64; -1 for unlimited)
- `-B` — disable auto-buffer allocation for pipes (use only 64KB)
- `-n` — suppress line number calculation (faster on large files)

### Other

- `-d` — suppress error on dumb terminal
- `-h n` — max backward scroll lines before repaint
- `-y n` — max forward scroll lines before repaint
- `-k file` — use lesskey binary file
- `--lesskey-src=file` — use lesskey source file
- `-x n,...` — set tab stops (default 8)
- `-"cc` — change filename quoting character
- `-q` — quiet mode (no bell on scroll boundary)
- `-Q` — totally quiet (never ring bell)
- `-u` — treat backspaces/carriage returns as printable
- `-U` — treat special characters as control characters
- `-Dxcolor` — set color for different text types
- `--use-color` — enable colored text
- `--mouse` — enable mouse scrolling and clicking
- `--wheel-lines=n` — lines per mouse wheel scroll (default 1)
- `--incsearch` — incremental search
- `--save-marks` — save marks across invocations
- `--no-histdups` — remove duplicate history entries
- `--file-size` — determine file size immediately on open
- `--follow-name` — follow renamed file during F command
- `--line-num-width=n` — minimum width for line numbers (default 7)
- `--status-col-width=n` — width of status column (default 2)
- `--rscroll` — character for truncated lines (default standout)
- `--no-keypad` — disable keypad init/deinit strings

## Examples

- `less +G file` — start at end of file
- `less -p "error" file` — start at first occurrence of "error"
- `less -N -S file` — display line numbers and chop long lines
- `less -R file` — display ANSI color escape sequences
- `less -F file` — exit if file fits on one screen
- `less -j.5 file` — position target line in middle of screen
- `less -o log.txt file` — pipe input to log.txt (when stdin is a pipe)
- `less -t mytag` — go to tag "mytag" (requires tags file)

## See Also

- [lesskey(1)](https://www.chedong.com/phpMan.php/man/lesskey/1/markdown)
- [more(1)](https://www.chedong.com/phpMan.php/man/more/1/markdown)
- [vi(1)](https://www.chedong.com/phpMan.php/man/vi/1/markdown)
- [ctags(1)](https://www.chedong.com/phpMan.php/man/ctags/1/markdown)
- [global(1)](https://www.chedong.com/phpMan.php/man/global/1/markdown)

---
type: CommandReference
command: less
mode: perldoc
section: 3
source: perldoc
---

## Quick Reference

- `use less 'CPU'` — request less CPU usage
- `use less 'memory'` — request less memory usage
- `less->of('CPU')` — check if CPU was requested
- `less->of()` — get list of requested features

## Name

less - perl pragma to request less of something

## Synopsis

perl
use less 'CPU';
## Description

This is a user-pragma. If you're very lucky some code you're using will know that you asked for less CPU usage or ram or fat or... we just can't know. Consult your documentation on everything you're currently using.

For general suggestions, try requesting "CPU" or "memory".

perl
use less 'memory';
use less 'CPU';
use less 'fat';
If you ask for nothing in particular, you'll be asking for "less 'please'".

perl
use less 'please';
## For Module Authors

The class method `less->of( NAME )` returns a boolean to tell you whether your user requested less of something.

perl
if ( less->of( 'CPU' ) ) {
    ...
}
elsif ( less->of( 'memory' ) ) {
    ...
}
If you don't ask for any feature, you get the list of features that the user requested.

perl
if ( less->of ) {
    ...
}
else {
    ...
}
## See Also

- [perlpragma](https://perldoc.perl.org/perlpragma)