Best way to start a process in background and logout on Linux

I very often have to start a process on Linux and logout leaving it running. I used to do a nohub.

nohub /path/to/some/pogram &

This does work but seeing the output of it you probably have to pipe the output to file like

nohub /path/to/some/pogram > /path/to/output &

But i will show you a better way SCREEN to the rescue to install:

sudo apt-get install screen

then simply run screen before you run the process and to disconnect the terminal and leave it running do a CRTL-A D which will take you back to the calling shell and you can log out leaving it running. You can do this with multiple processes.

to access it again type

screen -r

There are several suitable screens on:
	6078.your-server-detail	(SOMEDATE)	(Detached)
	4249.your-server-detail	(SOMEDATE)	(Detached)

and to reconnect do

screen -r 4249

This is ideal if you have to start some docker processes on remote servers.

Leave a Reply

Your email address will not be published.

Reload Image