Hacker News new | ask | show | jobs
by antoineMoPa 2427 days ago
grep, find, tail -f (useful to look at log files as they update)

Extras: sort, uniq, sed, sftp, apropos, man

1 comments

tail -F

This will also follow a log file if it rotates.

I just found out a few days ago that `-F` works with multiple files, too. When there's new content on one, tail prefixes the output with a header, telling you what file it is.

I've used that to watch all logs apache and descendant processes could be writing to:

  pstree -p $(pgrep -o apache2) \
  | grep -Po '[^}]\(\K\d+'
  | sed ':b;N;$!bb;s/\n/,/g' \
  | sudo xargs lsof -d 0-1000 -a -p \
  | grep -Po '\S+$' \
  | grep 'log' \
  | sort -u \
  | xargs tail -F