The problem is that if I execute a command (eg. a Python script), the terminal or script is waiting until the program return a exit status so that it can continue or return to terminal. Is there a way to circumvent this?
3 Answers
In most shells, you can launch commands or processes in the background by appending an ampersand (&
) to the command:
python file.py &
-
Already tried this but it does not work.– user1527118Jan 14, 2013 at 20:22
Several choices:
- Run it in screen.
man screen
,screen
,myprorgamm
,C-a d
,screen -r
. nohup myprogramm
myprogramm &
-
Tried:
$ screen _command_
,$ nohup _command_
$ _command_ &
. Nothing worked so far.– user1527118Jan 14, 2013 at 20:19 -
You need to start screen separately first; and if you don’t have screen, install it first.– pokeJan 14, 2013 at 20:20
-
1for screen - start with
man screen
, it's complex app with lots and lots of functionality.nohup
and&
(aka detach) can't "not work", really. if there is any error - make sure to post it here.– icedJan 14, 2013 at 20:23 -
Hey, the amperstand workaround is working, but for some unknown reason I must double-click on a terminal window because the new line does not show up for some reason. Solved, thank you!– user1527118Jan 14, 2013 at 20:32
Yes. If you're using Bash or a similar shell, type:
./your_script.py &
-
Tried that from the terminal but it does not work.– user1527118Jan 14, 2013 at 20:04
-
What OS and shell are you using?– Ivan YurchenkoJan 14, 2013 at 20:05
-
Trisquel GNU/Linux with dash. In Terminal I am using bash, while in scripts dash. Either of these does not work. The command I am trying to execute is /usr/share/screenlets/CircleClock/CircleClockScreenlet.py which is a part of a program called Screenlets (also available in Ubuntu).– user1527118Jan 14, 2013 at 20:13