Reattaching a process started with nohup

nohup

Is it possible to reattach a process started with nohup?

For example, start in a terminal:

nohup tail -f /dev/null &

Close the terminal. Now open a new terminal. How do you reattach the nohup'd process to this new terminal?

Best Answer

You can use tools such as reptyr to reattach a running process to a new terminal, generally speaking though it's a lot simpler to plan ahead and simply launch the process inside screen or tmux - that way you don't need nohup, and you can connect/disconnect at will.