1

I have a file with really long lines that I am trying to view in less. If I am near the top of the file, I can arrow right or use -S (to disable line wrapping) and then press down arrow or e and it will move down by one line. But if I am near the end of the file, this doesn't work. It just says END.

I noticed that there is an ESC-SPACE shortcut to move by a page even if near the end of the file, but ESC-e doesn't work. So I have to use -S ESC-SPACE and then UP ARROW many times (being careful not to go too far!) to move down a line.

I also tried searching for a newline with /\n but that just searched for the letter n (less --version says it is compiled with POSIX regular expressions, maybe that is the problem).

Is there a simpler way to move down by a single line in less. I really would like for RIGHT ARROW DOWN ARROW to "just work" even if it is near the end of the file.

1
  • Sometimes I just use ´mcview´ which is a part of midnight commander as a workaround . You can wrap/unwrap, switch to hex view, etc. Maybe that works for you. Commented Dec 30, 2016 at 20:04

1 Answer 1

1

less seems to support pressing J (i.e. shift+j) to always scroll one line, even when at the end of the file. Conversely, K will always scroll the other way, even when at the top of the file.

I'm unable to determine out how I found this the first time! If anyone has any pointers, would be good to see what other commands exist.

1
  • I found this in the less manpage: J Like j, but continues to scroll beyond the end of the file.. It isn't mentioned in the less online help (h). I guess that help isn't exhaustive. It seems that both K and Y do this for the beginning of the file. Commented Jan 10, 2017 at 22:01

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.