terminal.cab

All commands

less

Topic: Files and folders

Program: less

Shows a file page by page, to scroll and search.

Package: text

Usage

less [FILE]

Description

Show FILE, or standard input, one screen at a time. Keys: q quits, space or f goes one screen on, b one screen back, j or Enter one line on, k one line back, g goes to the start, G to the end, /TEXT searches forward, ?TEXT backward, n finds the next match, N the one before.

Options in the simulator

7 more options of the real program, not in the simulator yet
  • -N, --LINE-NUMBERS not in the simulator yet

    On a real system less then shows line numbers.

  • -S, --chop-long-lines not in the simulator yet

    On a real system less then cuts long lines instead of wrapping them.

  • -i, --ignore-case not in the simulator yet

    On a real system less then searches without caring about upper and lower case.

  • -R, --RAW-CONTROL-CHARS not in the simulator yet

    On a real system less then shows colours from control characters.

  • -F, --quit-if-one-screen not in the simulator yet

    On a real system less then quits at once if the text fits on one screen.

  • -X, --no-init not in the simulator yet

    On a real system less then leaves the text on the screen after quitting.

  • -V, --version not in the simulator yet

    On a real system it prints the version of less.

Examples

From the lesson Looking into files: cat, less, head and tail
less Documents/recipes.txt

Try it in the terminal

From the lesson Reading logs without drowning
less logs/app.log | head -n 3
09:12:04 INFO  worker 1 started
09:12:04 INFO  worker 2 started
09:13:40 INFO  request served in 91ms

Try it in the terminal

From the command of the day: less and /
less Documents/notes.txt
Book train tickets
Return library books
Pay the power bill
Back up the laptop
Fix the bike light
(END)

Try it in the terminal

Where you learn it

Lessons

Command of the day

All commands