Ubuntu – Default GNU screen “screens”

gnu-screen

As the title says, I would like to set up GNU screen on my headless box such that when it starts up with some screens already running.

My .bashrc file runs screen on the first login with screen -xRR and I would like htop and various logs to be automatically opened.

Is it also possible to assign titles to the screens at the same time?

Best Answer

You can define default windows in your Screen configuration file, ~/.screenrc.

Window titles can be set inline with the -t option, but working directories must be set in advance of launching each window. For example, in your case you might include the following:

~/.screenrc

# ...

chdir ~
screen -t "Htop" htop

chdir /var/log
screen -t "System log" tail -F syslog
screen -t "Mail log" tail -F mail.log

chdir ~
screen   # Extra Bash window for running commands

# ...

Note that the screen here is not the screen command you run, but an internal screen command. See man screen, section on Customization, or the GNU manual for more.