Have you ever having to control more than a single file with your
tail -f ?
I will and I just recently found out that you can run the tail command specifying the -f flag several times so you can give the command:
tail -f /varlog/messages -f /var/log/syslog
You’ll get an output like this:
==> messages <== Nov 22 00:43:07 laptop kernel: [ 61.487969] ADDRCONF(NETDEV_UP): eth0: link is not ready
==> syslog <== Nov 22 00:43:31 laptop pulseaudio: ratelimit.c: 1 events suppressed
==> messages <== Nov 22 00:43:31 laptop pulseaudio: ratelimit.c: 1 events suppressed
==> syslog <==
Nov 22 00:45:44 laptop ntpd: kernel time sync status change 6001
So you’ll have logged on screen the most recent of all the files you have listed in the tail command.
An alternative (available on Ubuntu and Debian for sure) it’s the package multitail
MultiTail lets you view one or multiple files like the original tail program. The difference is that it creates multiple windows on your console (with ncurses). It can also monitor wildcards: if another file matching the wildcard has a more recent modification date, it will automatically switch to that file. That way you can, for example, monitor a complete directory of files. Merging of 2 or even more logfiles is possible. It can also use colors while displaying the logfiles (through regular expressions), for faster recognition of what is important and what not. It can also filter lines (again with regular expressions). It has interactive menus for editing given regular expressions and deleting and adding windows. One can also have windows with the output of shell scripts and other software. When viewing the output of external software, MultiTail can mimic the functionality of tools like ‘watch’ and such.
- None Found