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.

Possibly related to Tail keeps snapping to the bottom after i scroll up with mousewheel

I can view my regular log files (on my local machine I mean) with tail -f and can scroll up or down. However, on one of our servers (Ubuntu 10.04.3 LTS) when I use tail -f on a log file it always snaps to the bottom and I can't scroll up.

I can't see anything about this in the man page. Anyone have any ideas?

share|improve this question
    
Did you try another terminal, like suggested in the other question? –  Gnoupi Aug 8 '12 at 9:50
    
@gnoupi - no, for two reasons: a) it's the same terminal (xterm) as i'm using on my local machine, which doesn't have the problem, and b) because i don't know how to make the server use a different terminal when you ssh onto it, and don't really want to start mucking around with that on the server in case it affects anyone else. –  Max Williams Aug 8 '12 at 11:46
    
Actually in reference to b), it's not the server using the terminal is it, it's my local terminal which i'm ssh-ing inside. Which doesn't help the problem. –  Max Williams Aug 8 '12 at 11:47
    
Try control-middle clicking your mouse inside the xterm window and check that "Scroll to bottom on Tty output" is deselected. –  Thor Aug 13 '12 at 19:17
    
What's odd is that it's now working as normal again. I haven't restarted my computer, the server, terminal (it's even the same tab as before) but i did lose my ssh connection and have to reconnect. @Thor - i don't have a ctrl middle mouse context menu but on the right click i have a profile menu, which has this dialog for the "scrolling" tab - dl.dropbox.com/u/846812/xterm.png . I can't see any options in there that would have created my problem tho. –  Max Williams Aug 16 '12 at 8:22
show 3 more comments

2 Answers

To expand on terdon's answer, less might be ideal for your usage. You will be able to interactively navigate and follow log files.

  • G ([Shift]-g) goes to the bottom of the file
  • F ([Shift]-f) waits for and follows new data (similar to tail -f)
  • [Ctrl]-c (interrupt signal) halts waiting for data and resumes standard navigation

Additionally you will have all the other functions which less offers (search, filter etc.)

share|improve this answer
    
ah, i didn't know about the F option in less - thanks! I do like the search in less. –  Max Williams Aug 16 '12 at 8:15
add comment

Why don't you use 'more' or 'less' or even 'cat'? tail -f will open the file and show content as it is added. Every time the output is refreshed you will snap to the bottom again. Unless you want to monitor the real time progress of the file use one of the tools above.

share|improve this answer
    
I do want to monitor the real-time progress of the file (that's why i use tail) but its nice to be able to scroll up and down as well. I didn't realise less has a F option which does the same thing. –  Max Williams Aug 16 '12 at 8:17
    
Oh and FYI less doesn't seem to allow mouse wheel scrolling up and down for me, which tail does (when it's behaving itself). –  Max Williams Aug 17 '12 at 14:07
    
Oh! That's weird... no idea –  terdon Aug 17 '12 at 14:10
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.