Home Explore Blog CI



man-pages

7th chunk of `less.man`
37e65fb7067e50515cfaca0e1bdc2e09ee02a3f6b374a3610000000100000fdf
 VISUAL is not defined, or defaults to "vi" if neither VISUAL nor EDI‐
              TOR is defined.  See also the discussion of LESSEDIT under the section on PROMPTS below.

       ! shell‐command
              Invokes a shell to run the shell‐command given.  A percent sign (%) in the command is replaced by the name of the current file.  A pound sign (#) is replaced by the name of the previously examined  file.   "!!"
              repeats the last shell command.  "!" with no shell command simply invokes a shell.  On Unix systems, the shell is taken from the environment variable SHELL, or defaults to "sh".  On MS‐DOS and OS/2 systems, the
              shell is the normal command processor.

       | <m> shell‐command
              <m>  represents any mark letter.  Pipes a section of the input file to the given shell command.  The section of the file to be piped is between the position marked by the letter and the current screen.  The en‐
              tire current screen is included, regardless of whether the marked position is before or after the current screen.  <m> may also be ^ or $ to indicate beginning or end of file respectively.  If <m> is . or  new‐
              line, the current screen is piped.

       s filename
              Save the input to a file.  This only works if the input is a pipe, not an ordinary file.

OPTIONS
       Command line options are described below.  Most options may be changed while less is running, via the "-" command.

       Most  options  may be given in one of two forms: either a dash followed by a single letter, or two dashes followed by a long option name.  A long option name may be abbreviated as long as the abbreviation is unambigu‐
       ous.  For example, --quit‐at‐eof may be abbreviated --quit, but not --qui, since both --quit‐at‐eof and --quiet begin with --qui.  Some long option names are in uppercase,  such  as  --QUIT‐AT‐EOF,  as  distinct  from
       --quit‐at‐eof.  Such option names need only have their first letter capitalized; the remainder of the name may be in either case.  For example, --Quit‐at‐eof is equivalent to --QUIT‐AT‐EOF.

       Options are also taken from the environment variable "LESS".  For example, to avoid typing "less -options ..." each time less is invoked, you might tell csh:

       setenv LESS "-options"

       or if you use sh:

       LESS="-options"; export LESS

       On MS‐DOS, you don’t need the quotes, but you should replace any percent signs in the options string by double percent signs.

       The  environment variable is parsed before the command line, so command line options override the LESS environment variable.  If an option appears in the LESS variable, it can be reset to its default value on the com‐
       mand line by beginning the command line option with "-+".

       Some options like -k or -D require a string to follow the option letter.  The string for that option is considered to end when a dollar sign ($) is found.  For example, you can set two -D options on MS‐DOS like this:

       LESS="Dn9.1$Ds4.1"

       If the --use‐backslash option appears earlier in the options, then a dollar sign or backslash may be included literally in an option string by preceding it with a backslash.  If the --use‐backslash option  is  not  in
       effect, then backslashes are not treated specially, and there is no way to include a dollar sign in the option string.

       -? or --help
              This  option  displays  a  summary of the commands accepted by less (the same as the h command).  (Depending on how your shell interprets the question mark, it may be necessary to quote the question mark, thus:
              "-\?".)

       -a or --search‐skip‐screen
              By default, forward searches start at the top of the displayed screen and backwards searches start at the bottom of the displayed screen (except for repeated searches invoked by the n or N commands, which start
              after or before the "target" line respectively;

Title: Less Command Manual: Editor, Shell Interaction, Saving, and Command Line Options
Summary
This section details how `less` interacts with external editors and shells, including invoking an editor via VISUAL or EDITOR environment variables, running shell commands with file name substitution, piping file sections to shell commands, and saving input to a file. It also describes command line options, their syntax (short and long forms), the use of the LESS environment variable for default options, and how options with string arguments are handled. The section further elaborates on specific options like displaying help and controlling search behavior.