1

I have a script that I activate via the terminal that listens to events. I want to keep using the terminal after the script runs, but the script is running and I can't type anything. The only way I know that lets me keep typing is by using the Ctrl + C combination, but this stops the script.

So how can I run the script in the background and keep using the terminal without terminating it?

Edit: I tried to use the '&' operator but it didn't work: enter image description here

Json
  • 655
  • 10
  • 27

1 Answers1

0

You can run your script in the background with:

python myscript.py &

If your script does output something you can suppress the output with:

python myscript.py 1>/dev/null 2>&1 &

Or save the output for later:

python myscript.py 1>myoutputfile 2>&1 &
# ...
less myoutputfile

Another alternative would be to use for example screen or tmux.

m13r
  • 2,458
  • 2
  • 29
  • 39