# Creating a screen, and run a command in it



## blackoutspy (Mar 21, 2008)

I find my self using screen a for things such as rsync and synergy but I struggle to find a way to programmatically create a screen and execute a command in it.

From the documentation I see that you can use the '-X' flag to tell a session to execute a command, but I haven't been able to work. I'm running commands like 'screen -Sr test ls' to create a screen named test and run ls inside it. I get no complaints about this syntax, but when i attach the screen i see no proof that the command was run.

What obvious thing am I missing here?


----------

