Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Why doesn't less's tail/scroll mode work with pipes?

For example, I'd like to make a build script pipe to less in order to make the output of the build script scrollable. So...

make | less +F

...or...

echo "make | less +F" | sudo sh

...would conceptually do what I want, but I get a blank screen. As soon as I exit scroll mode, I see as much of the script's output as was printed to the console at the time I exited scroll mode and less stops updating from that point forward. Typing F in less again has no effect.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

I had a similar question a while ago:

http://superuser.com/questions/157620/use-less-pager-on-file-with-non-standard-encoding

less +F does not work on pipes at all (only on regular files), due to the way it's implemented (see my own answer to the question above).

The only workaround apparently is to redirect the script's output into a temp file (using >). Then you can use less +F on the temp file.

share|improve this answer
1  
-F is "quit if one screen" - you mean +F –  Dennis Williamson Sep 10 '10 at 0:57
    
Thanks for pointing it out, fixed. –  sleske Sep 10 '10 at 1:13
    
Excellent! Exactly the answer I was looking for! Thank you! –  Christopher Parker Sep 10 '10 at 12:30
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.