tail utility is one of the most useful tools an admin has — but it’s also a bit limited and dated. For watching two or more logs at once, and much more, you want MultiTail.
The tail utility is one of the most useful admin tools, but it’s limited and outdated. Bring your log-watching capabilities into the 21st century and view multiple logs at one time with MultiTail.
What’s MultiTail? It’s an ncurses utility that can display multiple files using “windows” (much like GNU Screen or Tmux) in a terminal or at the console. It also supports color highlighting, filtering and much more.
To get MultiTail, head over to the download page or see if your operating system already has packages. On Debian-based systems, you should need to look for only the
multitail package. The project released an update (5.2.8) on April 14, so the most recent release probably won’t be in your upstream package repo just yet.
Once it’s installed, run
multitail and hit
F1. It will pop up a help menu with all of its keybindings. You’ll need to scroll down (use the down arrow key) to see all of the commands. It can be deceptive, otherwise, and it looks like you just have a few commands. Let’s look at a couple of the commands you’ll want to start with.
t — this displays the stats for your instance of MultiTail. To add files, use the
If you want to start
multitail with a file or output of a command to access, use
multitail filename or
multitail filename1 filename2 for more than one file. Use
multitail -R 3 -l "command" -R 3 -l "command2" to see two commands displayed in one window.
h command within MultiTail, you can set the height of each window. If you want to search through a window, use
shift+/ to highlight the search string. Using
I will toggle case sensitivity.
When you’ve used the search feature, you’ll get a buffer that displays in a “window” above the file. You can write this to a file using
s, which will bring up a dialog that prompts for a filename to which to save.
If you get a MultiTail session configured just right you can save it for later using
w from within the session. It will prompt you for a filename to which to save the script.
Basically, you can do just about anything you’d be able to do with
tail and then some. It’s very interactive, and much of its commands have dialogs that will walk you through creating regular expressions or re-arranging windows and more.
The only caveat I have is that, occasionally, MultiTail is a bit crashy. Not wholly unreliable, but I have managed to crash MultiTail a few times while putting it through its paces. (I’ve never managed to crash
tail…). But it’s still an invaluable tool to have around for any Linux or UNIX admin.
Brockmeier is a freelance writer and editor with more than 10 years covering IT. Formerly the openSUSE Community Manager for Novell, Brockmeier has written for Linux Magazine, Sys Admin, Linux Pro Magazine, IBM developerWorks, Linux.com, CIO.com, Linux Weekly News, ZDNet, and many other publications. You can reach Zonker at firstname.lastname@example.org and follow him on Twitter.