Monitoring several log files in one terminal window using screen

When debugging website problems I often run tail on /var/log/apache2/error.log or on /var/log/apache2/access.log. Today I needed to monitor both at the same time. One solution is to open two terminal windows, however this uses up valuable entries in the alt-tab list. A better solution for this purpose was to create two windows with the screen utility.

There are 3 key commands to use:

  • "Ctrl-a |" which splits the screen into two windows
  • "Ctrl-a <tab>" which sends focus to the next window
  • "Ctrl-a c" which opens a new shell in the current window

So after running screen, I ran
tail -f /var/log/apache2/error.log
I then pressed "Ctrl-a" followed by "|" (after releasing the control key) to split the window, "Ctrl-a" followed by tab to switch focus into the window I just created, "Ctrl-a" followed by "c" to start a new shell, and finally:
tail -f /var/log/apache2/access.log

Split screen monitoring

By ff

Systems software engineer with interests in C/C++/Rust on Linux, electronic music and games.

Leave a Reply

Your email address will not be published. Required fields are marked *