How do you run `less` and have it run a search pattern automatically?

From the man page:

   -ppattern or --pattern=pattern
          The  -p  option  on the command line is equivalent to specifying
          +/pattern; that is, it tells less to start at the  first  occur-
          rence of pattern in the file.

This works as expected using the latest version of less (436).


You can use + to send arbitrary commands. E.g.:

less +/pattern

-p PATTERN (as posted by nik) is equivalent to +/PATTERN.


You mean like?

less -p PATTERN filename

That is in the manual.