less -jn
where n is a line number to jump to is not working for me. It just has no effect. I'm running less version 436 on Ubuntu 11.04. I also tried less --jump-target=200
and LESS='-j200' less filename
.
1 Answer
ceving's answer explains what -j
does. I think you're looking for
less +200 filename # jump to line 200 (the first line is 1)
The +NUM
switch to jump to line NUM is fairly common amongst unix text viewers (starting with more
) and editors. In less, it's an instance of the more general +command
which lets you execute a command automatically after opening the file. Other common examples:
less +200P filename # jump to the line containing byte 200
less +G filename # jump to the end of the file (G command)
less +/hello filename # jump to the first occurrence of hello