Search command in less

  • Thread starter nvn
  • Start date
  • #1
nvn
Science Advisor
Homework Helper
2,128
32

Main Question or Discussion Point

When perusing a file using the linux less command, and you use the less search command inside less, I would like to know how to make less not display the line containing the target search string as the very top line of the session window (very poor design). I want the target line to always be at least the fourth line down from the top of the window (or lower), so I can see the found string in context, showing a few lines before (and after) the target line. Any help would be appreciated.
 

Answers and Replies

  • #2
nvn
Science Advisor
Homework Helper
2,128
32
Problem solved. The problem is solved by using the less -jn option, explained on the less man page.
 

Related Threads on Search command in less

Replies
5
Views
1K
Replies
1
Views
2K
  • Last Post
Replies
4
Views
4K
  • Last Post
Replies
6
Views
2K
  • Last Post
Replies
7
Views
5K
  • Last Post
Replies
3
Views
4K
  • Last Post
Replies
1
Views
2K
  • Last Post
Replies
1
Views
3K
  • Last Post
Replies
1
Views
1K
  • Last Post
Replies
10
Views
3K
Top