Skip to content

Instantly share code, notes, and snippets.

@PMaynard
Created May 14, 2015 15:15
Show Gist options
  • Save PMaynard/55946085dd8feabfa7b6 to your computer and use it in GitHub Desktop.
Save PMaynard/55946085dd8feabfa7b6 to your computer and use it in GitHub Desktop.
Insert commands to a screened session.
# Create a screened bash instance.
screen -S term01 bash
# Open a new terminal window and send the command 'ls\n' - the newline runs the command.
screen -S term01 -p 0 -X stuff "ls\n"
# -S <name> is the screen name
# -p 0 - tells it to use the first window, there can be more than one. (Default one)
# -X stuff '<cmd>' - Send the specified command to a running screen session.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment