Is there a way wherein we can start a screen, execute a command and detach it without actually entering into the screen? something like

screen -[some option] [command tobe executed]

I need this because i have about 100 files that each have different input files and i need to run each on a screen and if the above is possible all i need to do is create a shell script..

Is there an option in screen that would let me do this?

migrated from stackoverflow.com May 20 '11 at 3:11

This question came from our site for professional and enthusiast programmers.


You can run screen in detached mode by using the -d -m option, eg.

screen -d -m some_cmd
  • thanks.. but what if i want to redirect the output to a file? like screen -d -m sudo ./mycode &>output but this just gives a blank file and the output is actually displayed inside the screen.. – Prasanth Madhavan May 20 '11 at 7:28

Try tmux (http://tmux.sourceforge.net/). It is much more suited to be used in this manner. Screen is optimized for interactive usage.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.