less

Command Execution

cp /path/to/command ~/.lessfilter
less /etc/hosts
LESSOPEN='/path/to/command # %s' less /etc/hosts

File Read

less /path/to/input-file

This can be used to read another file, e.g., when invoked as a pager with some fixed content.

less /etc/hosts
:e /path/to/input-file

This can be used to read another file.

LESSOPEN='echo /path/to/input-file # %s' less /etc/hosts

File Write

echo DATA | less
s/path/to/output-file
q

Inherit

less /etc/hosts
v

Shell

less /etc/hosts
!/bin/sh

The optional `reset` command is needed to receive the echo back of the typed keystrokes.

LESSOPEN="/bin/sh -s 1>&0 2>&0 # %s" less /etc/hosts
reset
VISUAL='/bin/sh -s --' less /etc/hosts
v