This is a quick post on how to create, manage and delete background processes with screen
About
Screen allows you to run processes in a different session, so when you exit your terminal the process will still be running.
Install
Install screen on the operating system of choice, for debian based systems it will be:
1
|
|
Working with Screen
To create a screen session, you can just run screen
or you can provide an argument to provide a name:
1
|
|
Now you will be dropped into a screen session, run a ping:
1
|
|
Now to allow the ping process to run in the background, send the commands to detach the screen session:
1
|
|
To view the screen session:
1 2 3 4 |
|
To resume the screen session, pass the screen id or screen name as a argument:
1 2 3 |
|
Scripting
To use a one liner to send a process as a detached screen session for scripting as an example, you can do that like this:
1
|
|
Listing the screen session:
1 2 3 |
|
Terminating the screen session:
1
|
|
Thank You
Let me know what you think. If you liked my content, feel free to visit me at ruan.dev or follow me on twitter at @ruanbekker