Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been using gnu-screen's 'logfile' command to log my session histories when making production changes. I like to log each change in a different directory; this means that whenever I start a new change, I need to execute the :logfile /path/to/change/directory/%t.log command again. I was wondering if there is a way to specify a logfile string when invoking screen?

The goal here is to be able to write a wrapper script, e.g. startchange [changenumber] which would then change to the correct change directory and configure screen to log any sessions in that directory.

The only solution I can think of at the moment is to have a script that makes a copy of my global .screenrc, replaces the logfile string, and invokes screen with the '-c' command line option. (screen doesn't appear to support reading multiple config files either.) This feels like a fairly heavyweight solution to what should be a fairly simple problem. Does anyone have any alternative approaches?

share|improve this question

screen puts it's output in the current directory, so could you instead have a wrapper script something like:


mkdir -p /path/to/logs/change-$1
cd /path/to/logs/change-$1
screen -L
cd $X

Not sure if this has any problems itself, but may give you another path to follow?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.