Home Explore Blog CI



man-pages

4th chunk of `less.man`
45233ce2209a77d16a1b84bc3aa0c01a3c4284572ef4f8f60000000100000fc5
 command line list, regardless of what is currently displayed on the screen or the settings of the -a or -j options.

              ^K     Highlight any text which matches the pattern on the current screen, but don’t move to the first match (KEEP current position).

              ^R     Don’t interpret regular expression metacharacters; that is, do a simple textual comparison.

              ^W     WRAP around the current file.  That is, if the search reaches the end of the current file without finding a match, the search continues from the first line of the current file up to  the  line  where  it
                     started.

       ?pattern
              Search backward in the file for the N‐th line containing the pattern.  The search starts at the last line displayed (but see the -a and -j options, which change this).

              Certain characters are special as in the / command:

              ^N or !
                     Search for lines which do NOT match the pattern.

              ^E or *
                     Search multiple files.  That is, if the search reaches the beginning of the current file without finding a match, the search continues in the previous file in the command line list.

              ^F or @
                     Begin the search at the last line of the last file in the command line list, regardless of what is currently displayed on the screen or the settings of the -a or -j options.

              ^K     As in forward searches.

              ^R     As in forward searches.

              ^W     WRAP  around  the current file.  That is, if the search reaches the beginning of the current file without finding a match, the search continues from the last line of the current file up to the line where
                     it started.

       ESC‐/pattern
              Same as "/*".

       ESC‐?pattern
              Same as "?*".

       n      Repeat previous search, for N‐th line containing the last pattern.  If the previous search was modified by ^N, the search is made for the N‐th line NOT containing the pattern.  If the previous search was  modi‐
              fied  by ^E, the search continues in the next (or previous) file if not satisfied in the current file.  If the previous search was modified by ^R, the search is done without using regular expressions.  There is
              no effect if the previous search was modified by ^F or ^K.

       N      Repeat previous search, but in the reverse direction.

       ESC‐n  Repeat previous search, but crossing file boundaries.  The effect is as if the previous search were modified by *.

       ESC‐N  Repeat previous search, but in the reverse direction and crossing file boundaries.

       ESC‐u  Undo search highlighting.  Turn off highlighting of strings matching the current search pattern.  If highlighting is already off because of a previous ESC‐u command, turn highlighting back on.  Any search  com‐
              mand will also turn highlighting back on.  (Highlighting can also be disabled by toggling the -G option; in that case search commands do not turn highlighting back on.)

       ESC‐U  Like ESC‐u but also clears the saved search pattern.  If the status column is enabled via the -J option, this clears all search matches marked in the status column.

       &pattern
              Display only lines which match the pattern; lines which do not match the pattern are not displayed.  If pattern is empty (if you type & immediately followed by ENTER), any filtering is turned off, and all lines
              are  displayed.   While  filtering  is in effect, an ampersand is displayed at the beginning of the prompt, as a reminder that some lines in the file may be hidden.  Multiple & commands may be entered, in which
              case only lines which match all of the patterns will be displayed.

              Certain characters are special as in the / command:

              ^N or !
                     Display only lines which do NOT match the pattern.

Title: Less Command Manual: Search Options and Filtering
Summary
This section details the search options in `less`, including reverse searching, repeating searches (forwards and backwards, with and without file boundaries), undoing search highlighting, and filtering the display to show only lines matching a given pattern. It also covers special characters that can modify search behavior.