Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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 wish to rejoin an existing screen (there is only one on my system) kill window 6:

screen -r -p 6 -X kill 

and execute the following command in a new window:

cd /opt/stack/neutron && python /usr/local/bin/neutron-dhcp-agent --config-file /etc/neutron/neutron.conf --config-file=/etc/neutron/dhcp_agent.ini

All I know is screen -r -X screen will start a new window (numbered 6) but how do I execute the above command in that window?

share|improve this question

Try to screen sub command.

screen -r -x -X screen 6 bash -c 'cd /opt/stack/neutron && python /usr/local/bin/neutron-dhcp-agent --config-file /etc/neutron/neutron.conf --config-file=/etc/neutron/dhcp_agent.ini'

NOTE: This window(window number 6) is automatically closed if last command (this case is python invoked from bash) ends.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .