The tail of several files in CentOS

I want to link several files (and follow them) on CentOS, I tried this:

tail -f file1 file2 file3

but the conclusion is very unfriendly

I also looked at the multi-title, but I can not find the version of CentOS.

What other options do I have?

+4
source share
6 answers

Multi-user accessibility is available for CentOS in the rpmforge repositories. To add an rpmforge repository, check out the documentation for third-party repositories .

+6
source

You can simulate multitasking by opening multiple instances of the -f tail in under Emacs windows.

+2
source

Usually I just open another xterm and run a separate tail -f.

Otherwise, if I use the screen tool, I will create separate tail -f commands. I don’t like it, because it takes a few keystrokes to turn on the screen before using the Page Up and Page Down keys. I prefer to just use the xterm scrollbar.

+2
source

I found that the solution described here works well on centos:

Link 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 
+2
source

You can use the watch command, I use it to create two files at the same time:

watch -n0 tail -n30 file1 file2

+1
source

The best answer to the old question ...

I am creating a shell function in my .bashrc (obviously assuming you are using bash as a shell) and using tmux. You can probably complicate this and do it without a temporary file, but quoting is just ugly if you are trying to ensure that files with spaces or other strange characters in the name still work.

 multitail () { cmdfile=`mktemp` echo "new-session -d \"tail -f '$1'\"" >$cmdfile shift for file in " $@ " do echo "split-window -d \"tail -f '$file'\"" >>$cmdfile done echo "select-layout even-vertical" >>$cmdfile tmux source-file $cmdfile \; attach && rm -f $cmdfile } 
0
source

Source: https://habr.com/ru/post/953894/


All Articles