Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tail multiple files in CentOS

I want to tail multiple files (and follow them) in CentOS, I've tried this:

tail -f file1 file2 file3

but the output is very unfriendly

I've also had a look at multitail but can't find a CentOS version.

What other choices do I have?

like image 471
Hintswen Avatar asked May 26 '09 01:05

Hintswen


3 Answers

Multitail is available for CentOS in rpmforge repos. To add rpmforge repository check the documentation on 3rd Party Repositories.

like image 65
Vihang D Avatar answered Sep 20 '22 18:09

Vihang D


I found the solution described here work well on centos:

The link is http://www.thegeekstuff.com/2009/09/multitail-to-view-tail-f-output-of-multiple-log-files-in-one-terminal/

Thanks to Ramesh Natarajan

    $ vi multi-tail.sh
    #!/bin/sh

    # When this exits, exit all back ground process also.
    trap 'kill $(jobs -p)' EXIT

    # iterate through the each given file names,
    for file in "$@"
    do
        # show tails of each in background.
        tail -f $file &
    done

    # wait .. until CTRL+C
    wait
like image 28
Kiran Avatar answered Sep 21 '22 18:09

Kiran


You could simulate multitail by opening multiple instances of tail -f in Emacs subwindows.

like image 39
Dave Avatar answered Sep 23 '22 18:09

Dave