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

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?

share|improve this question

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

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

up vote 1 down vote accepted

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

screen -d -m some_cmd
share|improve this answer
    
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.

share|improve this answer

You must log in to answer this question.

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