News for hackers. Stuff that matters.
Re:Stop using tail -f (mostly) by vbezhenar on Monday March 30, 2015 @02:20PM (#9291449)
On large files less fires up immediately and vim is quite slow. I think that vim is loading an entire file in the memory while less just loads visible chunk. May be other vi implementations are more efficient with large files.

Besides — vim really shouldn't be used on log files. It's editor, not viewer.

Re:Stop using tail -f (mostly) by pjungwir on Monday March 30, 2015 @03:44PM (#9292060)
> Besides — vim really shouldn't be used on log files. It's editor, not viewer.

I think the two concerns I stated are probably legit, but this one is boring to me. Vim is nicer than less for reading files. I have more navigation commands. I can yank part of the file and save it somewhere else. I can pipe a range of lines through awk/etc. I can switch between files. I can split my screen. Etc. Some of these are probably available in less too (more than more(1) supported in 2001), but I doubt all, and I already know the commands in vim. I'm interested in not clobbering my logs and not crashing the server, but if you tell me vim is an editor not a viewer, I'll ask Why?

Btw re-reading my words I don't mean to sound combative. But the point of my original question was to understand. I've been cargo-culting "use less for logs" for 14 years already.

Re:Stop using tail -f (mostly) by kragen on Monday March 30, 2015 @04:55PM (#9292548)
You can save a part of the file, pipe a range of lines, or switch between files in less, too, and the commands are mostly the same as in vi. It'd sure be nice to be able to split the screen, though!
Re:Stop using tail -f (mostly) by EdiX on Monday March 30, 2015 @03:23PM (#9291920)
> I think that vim is loading an entire file in the memory while less just loads visible chunk

No, vim also only keeps part of the file loaded, however it will try to count how many lines the file has.

Re:Stop using tail -f (mostly) by robmil on Monday March 30, 2015 @04:44PM (#9292462)
Vim ships with a command called `view` that will start it in read-only mode, and makes it very much a viewer — not just an editor.
Re:Stop using tail -f (mostly) by dredmorbius on Monday March 30, 2015 @09:56PM (#9293940)
True, and I like using this for syntax-colored views of files. But it's got an annoying tendency to switch to edit mode with very little fuss.

Sometimes I want a viewer to just be a viewer.

Speaking of which: are there any Linux/Unix viewers that do have generalized syntax highlighting support?

Re:Stop using tail -f (mostly) by notfoss on Tuesday March 31, 2015 @02:07PM (#9298581)
You can give vimpager a try. It even supports vimrc. But I have felt it to be considerably slower than less.
Re:Stop using tail -f (mostly) by sukilot on Tuesday March 31, 2015 @11:16AM (#9296825)
chmod :)
Re:Stop using tail -f (mostly) by dredmorbius on Thursday April 02, 2015 @07:32PM (#9313800)
It took me way too long to grok that.
Re:Stop using tail -f (mostly) by oimaz on Monday March 30, 2015 @04:43PM (#9292453)
With vim, I usually use 'vim -u NONE <file-name>' which skips the startup file and makes loading zippy
Re:Stop using tail -f (mostly) by ryen on Monday March 30, 2015 @04:44PM (#9292463)
It may also try to do syntax highlighting and other formatting stuff, taking up even more resources and cpu time.
Re:Stop using tail -f (mostly) by sliverstorm on Monday March 30, 2015 @04:01PM (#9292179)
And an editor should not be used on log files?

Frequently, frequently I am in the position that I need to manipulate an overly-verbose log file to condense out the information I want. I could spend a half hour concocting wizard-like shell invocations, OR I could do it interactively in five minutes with vi...