Keep running a process exiting SSH - $screen
Hi, everybody,
Sorry it's been a long time since the last post, unfortunately I'm very busy and at the moment and I'm the only editor.
Today we talk about a very useful command when you are in an SSH session and I bring you two examples.
- first one maybe you have opened an SSH session but you have to do more things and you don't want to open multiple SSH sessions
- second one you have to execute a command or procedure that will take a long time and so you would also like to exit the SSH session and let the command run.
Here comes the SCREEN application to support us in this.
So before you try anything, make sure you have it installed.
Here are some of the most useful and basic screen commands:
`screen <command>` // This will create an instance of screen and run your commend inside
`ctrl + a` and after press letter `d`// This will detach the screen now you can exit ssh and the process will keep running
`screen -r` // this will recover the latest screen with the process you were running
`screen -ls` // it will list all the running screens and their PIDs
`screen -r 25172` // this will resume the screen with the PID 25172
`screen -X -S 25172 kill` // this will kill the screen with the PID 25172