My question seems to be quite easy, but for some reason I did not find a quick answer to it. I have a python script that I want to run on the terminal command line (Ubuntu linux server), which works for me. But then I can't use the command line until the script ends. The script takes a long time to run, and I would like to continue using the command line to perform other tasks. How can you do the work of a script when its progress is not shown on the command line, but keep its work? And how can I see the active processes that are running on the server to see if a process is running?
Run script command:
python script.py
Add next with & echo "123"
:
CodePudding user response:
The script takes a long time to run, and I would like to continue using the command line to perform other tasks.
It seems that you want to run said process in background, please try pasting following
python script.py &
echo "123"
it should start your script.py
and then output 123
(without waiting until script.py
ends)
how can I see the active processes that are running on the server to see if a process is running?
Using ps
command
ps -ef
will list all processes which you would probably want to filter to get interested one to you.