简体   繁体   中英

unix or perl one liner for tailing more than one file at the same time

Can someone help me come up with a quick unix or perl one liner to tail Xn of logs at the same time? I just need to quickly view 2 or more logs on stdout, enough lines to view on my screen.

I am using tail -30 filename_1.out for example, but have to arrow up and change the 1->2->3. But I really want to do is tail a couple of few of them in one pass, if the filenames were filename_1.out , filename_2.out , filename_3.out

tail can be given many files at once; try

tail -30 filename_[123].out

If

tail -30 filename_*.out

wouldn't work on a particular version of the userland tools (?) then you could always do:

(for a in filename*.out; do tail -f "$a"& done) | tail -f

eg to follow the tail

如果你的操作系统支持它使用multitail - 这正是你想要的。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM