Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

People also ask

How do you tail multiple files at once?

To tail multiple files with multitail simply invoke the program followed by the two filenames you wish to follow. The nice thing about multitail is it creates two panes, one for each file. These panes can scroll independently and search works across both panes.

How do you tail a log file continuously?

The tail command is fast and simple. But if you want more than just following a file (e.g., scrolling and searching), then less may be the command for you. Press Shift-F. This will take you to the end of the file, and continuously display new contents.

How do I chmod all folders and subfolders?

Use chmod -R 755 /opt/lampp/htdocs if you want to change permissions of all files and directories at once.


To log all the files inside a folder, you can go to the folder and write

tail -f *.log

To add the subfolders to the tailf command, use

tail -f **/*.log

Of course, the regular expression can be improved to match only specific file names.


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


If all log files doesn't have same extension. You can use following command.

tail -f **/*

This way find files recursively, print lines starting on line 5 in the each file and save on concat.txt

find . -type f \( -name "*.dat" \) -exec tail -n+5 -q "$file" {} + |tee concat.txt