Run process in background

Sometimes we need to run process in background, I prefer screen.

How to install screen?

sudo apt-get install screen

How to use screen?

screen -S session_name

Execute your commands what you need. – Detach screen from the terminal (your commands will be still running):

Press Ctrl+a+d

Close the terminal  – Open another terminal and reattach the last screen session:

screen -r

 

Example:

1. List screens:

screen -ls

OUTPUT:

No Sockets found in /var/run/screen/S-root.

2. Run example process (I run torrent deamon):

screen -t TORRENT qbittorrent-nox

3. Detach screen with wanted process:

Press Ctrl+a+d

4. List screens

screen -ls

OUTPUT:

There is a screen on:
        3962.TORRENT    (09/30/2014 12:12:25 PM)        (Detached)
1 Socket in /var/run/screen/S-root.

That’s all!

Leave a Reply

Your email address will not be published. Required fields are marked *