r/linux • • Mar 30 '15

Stop using tail -f (mostly)

http://www.brianstorti.com/stop-using-tail/
830 Upvotes

219 comments sorted by

View all comments

95

u/berkes Mar 30 '15

On a sidenote: I teach people to always use tail -F instead of tail -f. You won't see the difference that often. But when you do, you wish you had started with -F instead.

-F same as --follow=name --retry tail(1).

You'll see the difference when you are tailing that log file to see why the deamon crashes on restart (only to find that on restart it also rotates the logs buy deleting and re-creating: tail stops)

You'll also see the difference when you keep tail running (e.g. in screen) and on re-opening to find you have to restart it.

And mostly, you'll see this breaking when some script or tool uses tail to e.g. monitor something and have that script crash when the log is rotated (poorly).

(edit: inserted some blank lines for legibility)

0

u/[deleted] Mar 30 '15

Additional few miliseconds of pressing shift and possibility of making file File when not caffeinated enough is not worth it

0

u/berkes Mar 30 '15

You mean -F will create a file under certain conditions? Never seen that, but I'd love to hear more.

2

u/[deleted] Mar 30 '15

No. I meant typing tail -F Filename instead of tail -F filename by holding shift few ms too long.

→ More replies (10)