Can't scroll tail up or down on server

0

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?

Max Williams

Posted 2012-08-08T09:29:39.440

Reputation: 2 237

Did you try another terminal, like suggested in the other question? – Gnoupi – 2012-08-08T09:50:32.783

@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 – 2012-08-08T11:46:08.320

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 – 2012-08-08T11:47:27.990

Try control-middle clicking your mouse inside the xterm window and check that "Scroll to bottom on Tty output" is deselected. – Thor – 2012-08-13T19:17:46.737

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 - https://dl.dropbox.com/u/846812/xterm.png . I can't see any options in there that would have created my problem tho.

– Max Williams – 2012-08-16T08:22:57.080

I was under the impression that you were using xterm, which has the aforementioned context menu. Which terminal are you using? – Thor – 2012-08-16T09:57:44.427

Ah, my point exactly. Based on the screenshot, he is using gnome-terminal, not xterm. – terdon – 2012-08-16T13:00:16.923

Hi guys - you're right, sorry, it is gnome-terminal. I don't know why i thought it was xterm - i guess because i used to use xterm and then switched to gnome-terminal (see related question). Latest on this is that it works fine in one tab which is ssh'd onto our server (the one that didn't work originally) and now doesn't work (ie keeps snapping to the bottom) on my local machine. Confused... – Max Williams – 2012-08-17T14:06:05.117

Answers

3

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.)

skeevey

Posted 2012-08-08T09:29:39.440

Reputation: 171

ah, i didn't know about the F option in less - thanks! I do like the search in less. – Max Williams – 2012-08-16T08:15:41.473

0

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.

terdon

Posted 2012-08-08T09:29:39.440

Reputation: 45 216

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 – 2012-08-16T08:17:01.097

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 – 2012-08-17T14:07:24.663

Oh! That's weird... no idea – terdon – 2012-08-17T14:10:05.720