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?


2 Answers 2


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.. May 20, 2011 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 agree to our terms of service, privacy policy and cookie policy

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