Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Screen supports externally controlling a detached screen with the -X parameter, for example:

screen # -X -p0 "quit"

That will terminate the screen where # is the screen PID. However what I want to do is pass a command "inside" the screen. So for example if the program inside is nano and I want to write "hello world" into that nano process how would I do it via screen?

 screen # -X -p0 "hello world"

That treats it as if I want the screen to run "hello world" (which isn't a command) but I want to pass it to the program running inside screen.

I can't find any information in the manual. I'm running centos.

share|improve this question
add comment

1 Answer

Solved!

For anyone reading this via google the answer is pretty simple: Stuff.

screen -x 1234 -X -p0 stuff $'hello world\n'
share|improve this answer
    
+1. Note that $'' is for your shell (likely bash) to interpret the \n as a newline. –  Roger Pate Jun 21 '10 at 2:33
add comment

Your Answer

 
discard

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.