Run a command in a shell and keep running the comm

2019-01-10 02:03发布

I am using Putty to connect to a remote server. What I want to know is if there is any way to write my commands and allow them to keep running after I close the session with Putty. The reason for this is that I do not want to keep the computer ON all the time. Is there any way to do this?.

Update with the solution

For my question as it is presented the best solution is use one of the commands provided such as nohup, because you do not have to install any additional software. But if you are in the same problem use screen, install it and use it. It is amazing.

I have selected the answer of Norman Ramsey as favourite because propose several solutions using commands and screen. But please check the other answers specially the one of PEZ, then you get an insight of what screen is able todo.

9条回答
▲ chillily
2楼-- · 2019-01-10 02:22

What you are looking for is nohup.

See the wiki link for how to use it.

查看更多
Evening l夕情丶
3楼-- · 2019-01-10 02:29

nohup, disown, and screen are all good but screen is the best because unlike the other two, screen allows you to disconnect from the remote server, keep everything running, and then reconnect later to see what is happening. With nohup and disown you can't resume interacting.

查看更多
一纸荒年 Trace。
4楼-- · 2019-01-10 02:35

If you can't use screen (because, for instance, your SSH session is being programmatically driven), you can also use daemonize to run the program as a daemon.

查看更多
登录 后发表回答