screen -dm -S myTest
This will create a screen session named 'myTest'. You can verify it was created with 'screen -list'. You should see something similar to the following when you type that command:
$ screen -list
There is a screen on:
31306.myTest (Detached)
1 Socket in /tmp/uscreens/S-mmasters.
Then you can send commands to the newly created screen session:
screen -S myTest -p 0 -X stuff 'top^M'
You have to type <control-v><control-m> to get the ^M character correctly. This command will essentially type 'top' and 'enter' in the screen session named 'myTest' for the 0th window. When you reconnect to the screen session, you should see top running. You can type 'q' to quit top.
The important part of this command is the -X. This switch can take several different commands. You can see all the commands available at
http://www.gnu.org/software/screen/manual/screen.html#Command-Summary
I found this link to be very helpful.
No comments:
Post a Comment