I know less +/pattern filename will open the file and navigate to the first occurrence of the pattern. Is there a way to tell less to search from the end backwards? Does it even accept more than one + switch?
Do not work:
less +?pattern filename
less +G +?pattern filename
less +G +?pattern filename, but then again, reading themanpage, it appears that only one+cmdis allowed. So, it appears that there is no way to achieve what I'm looking for. – ultracrepidarian Dec 21 '17 at 20:10less +/cd .bash_historyvs.less +?cd .bash_history. The first example opens the file and navigates to the first occurrence ofcdin your bash history (hopefully you have them). The second example does nothing, except open the file, as if it'sless .bash_history. – ultracrepidarian Dec 21 '17 at 20:33less +?cd .bash_historyon my system shows the latest occurrence ofcdin my bash history. Perhaps you have theLESSenvironmental variable set in a way that is overriding what I'm expecting? – davidmneedham Dec 21 '17 at 20:36$LESSis not set. – ultracrepidarian Dec 21 '17 at 20:52less +'?cd' .bash_history. – ultracrepidarian Dec 21 '17 at 21:00?patternmeans that the file is searched in the backward direction. So then lowercase n continues the search in the backward direction, and uppercase N searches in the reverse direction of backwards (the forward direction). – davidmneedham Aug 30 '21 at 19:24