How to tail all the log files inside a folder and subfolders?

前端 未结 4 1714
小鲜肉
小鲜肉 2020-12-23 16:27

In Linux, using the command tailf, how can I tail several log files that are inside a folder and in the subfolders?

4条回答
  •  生来不讨喜
    2020-12-23 16:53

    This will recursively find all *.log files in current directory and its subfolders and tail them.

    find . -type f \( -name "*.log" \) -exec tail -f "$file" {} +

    Or shortly with xargs:

    find . -name "*.log" | xargs tail -f

提交回复
热议问题