Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 use the screen command line program in Linux all the time, and I looked through the man page but didn't find the answer to this (although maybe I just missed it):

What I want to do is have a single command that splits the current region, tabs to the new region, and opens a new screen in it. I hoped there was some way to maybe go into command (colon) mode and do something like split; focus down; screen but that doesn't work. Any ideas? Is it possible to maybe bind a series of commands to a single C-a binding?

share|improve this question
Is bind not working for you? Something like bind ^s split focus down screen? – DaveParillo Jan 11 '10 at 22:59
split focus down screen (I also tried binding it to C-a e), gives an error: split: no arguments required. I've read through most of the man page again and still see no way to execute multiple commands series; there appears to be no macro or multiple-command capability. – dirtside Jan 11 '10 at 23:32
up vote 6 down vote accepted

Have you tried:

register s ^aS^i^ac
bindkey ^a,, process s

From the depths of the screen manual:

register [-e encoding] key string

Save the specified string to the register key. The encoding of the string can be specified via the -e option. See also the "paste" command.


process [key]

Stuff the contents of the specified register into screen's input queue. If no argument is given you are prompted for a register name. The text is parsed as if it had been typed in from the user's keyboard. This command can be used to bind multiple actions to a single key.

share|improve this answer

You could also arrange some files this way:


focus down


bind e source $HOME/.myscreenmacro

This is a little clearer than the other ways.

share|improve this answer
This is a great tip! Perfect for one-off stuff sessions. For example, I had a vim recording that wouldn't repeat for some reason. I could only get it to go by hitting @q again and again (even @@ didn't work.) Created a text file with "stuff @q" repeated 100 times, then sourced the file and away we went! – funroll Aug 31 '12 at 2:46
You can also add in "sleep 0.1" if you need to tweak the timing. – funroll Aug 31 '12 at 2:48

Screen's command eval is handy for creating this kind of macros:

screen -X bind e eval split 'focus down' screen

Commands expecting arguments (like focus down) need to be quoted (single or double).

share|improve this answer
Thanks, your answer helped me to map ' ' such that I enter copy mode and immediately start the marking (to behave as if I typed '[ '). This is what I put into .screenrc: register s ' ' bind ' ' eval 'copy' 'process s' (register and bind being on separate lines). – haridsv Apr 15 '11 at 19:21

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.