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.

I am trying to tail file with pagination

tail -f foo.txt | more

This works fine until file gets lets say 200 lines injected, when this happens nature of tail command is to go to end of file, at that point I lose track of trailing the log. Is there a way to avoid this?

share|improve this question
3  
Use less instead of more. –  choroba Nov 2 '12 at 13:29
5  
Decided to double down? askubuntu.com/questions/210960/paginate-with-tail-f-command –  Snesticle Nov 2 '12 at 13:35
    
@Snesticle Yes I'm desperate, is it against the rules? –  Dolphin Nov 2 '12 at 13:40
    
Are you reading from a pipe? If so your option "-f" gets ignored. –  Snesticle Nov 2 '12 at 13:56
1  
@Dolphin ss64.com/bash/tail.html –  Snesticle Nov 2 '12 at 14:36
show 5 more comments

1 Answer

up vote 4 down vote accepted

Use less with +F instead of tail/more:

less +F foo.txt

When you want to take a look around, hit Ctrl-c. To restart following (tailing), hit F.

share|improve this answer
    
Not exactly what I had in mind but works nicely. Thank you +1 from me and if nothing closer to target accept from me. –  Dolphin Nov 2 '12 at 14:32
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.