Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

suppose I have this: cat new_file.txt | less -FRSX

Then suppose I press the right button in order to scroll to the right

This will cause the contents of new_file.txt to move to the top of the command line and moreover there's a whole bunch of empty space between content of new_file.txt and the current command

For instance here's what it'll look like

contentsofnewfile.txtyupmorecontenntsconteeentsss
~
~
~
~
~
~
~
~
.
.
.
~
(END)

how do I make it so that even if I press the right button, the content of the file stays where it is instead of moving to the top (though it should still scroll to the right) and moreover that there will be no empty lines such as the

~
~
~

displayed above

share|improve this question
    
It doesn't here... -FX should stop that. –  derobert Oct 18 '13 at 16:36
    
be sure to include -S ... the point is to allow right scrolling ... without -S it's pointless –  pillarOfLight Oct 18 '13 at 19:31
    
Ah, I see what you're talking about. It happens when a line is longer the than terminal width & you press right. –  derobert Oct 18 '13 at 19:33
    
I suspect that the answer is “download the code source, write the code for that feature, recompile”. –  Gilles Oct 18 '13 at 23:08
add comment

1 Answer

Do a cat new_file.txt | less -FRSXc. That fixes the first issue.

For the second issue use a tilde cat new_file.txt | less -FRSXc~

From the man pages for less:

-c or --clear-screen Causes full screen repaints to be painted from the top line down. By default, full screen repaints are done by scrolling from the bottom of the screen.

-~ or --tilde Normally lines after end of file are displayed as a single tilde (~). This option causes lines after end of file to be displayed as blank lines.

share|improve this answer
    
so if I do that there's still a huge space between the end of file and the current command...is there a way to remove that space altogether (ie don't even display blank lines - just have the end of file be right above the current command) –  pillarOfLight Oct 21 '13 at 14:48
    
No. Less is a program that runs in the shell. It's not actually stdout. That's why you have to end the program when it's done. –  Jeight Oct 21 '13 at 15:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.