Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
300 views
in Technique[技术] by (71.8m points)

ssh - How to move a running process to background (UNIX)

I have a terminal connected to an external machine through ssh and have a process running in it. Is it possible move the execution to the background, so that I can close the ssh connection without the need to kill it? If so how?

question from:https://stackoverflow.com/questions/46283647/how-to-move-a-running-process-to-background-unix

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Press control + Z, which will pause it and send it to the background. Then enter bg to continue it's running in the background.

Alternatively, if you put a & at the end of the command to run it in the background from the start.

This will just make it run in the background and once you log out it will still be killed. In order to keep it running after logout you will need to "disown" the process with disown -h, so that the shell doesn't count it among your processes needing to be killed on logout. See this post for more details.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...