screen allows you to run commands in the remote server even after you disconnect.
disconnect from a session
Press
CTRL + A, then press CTRIL +D in quick succession.
You can also close the terminal, the screen session will continue in the background.
| screen -ls | List all available screen sessions |
| screen -r | Reconnect to a disconnected screen session |
| screen -S work | start a named session |
| screen -r ID / screen -r “name” | reattach specific session |
| screen -d -r | detach and reattach |
| screen -RR | reattach if possible, otherwise create |
| Ctrl-a d | detach |
| Ctrl-a c | create a new window |
| Ctrl-a n / Ctrl-a p | next / previous window |
| Ctrl-a “ | list windows |
| Ctrl-a A | rename current window |
| Ctrl-a | | vertical split |
| Ctrl-a Tab | move focus between regions |
Run a script inside screen
screen -dmS sessionName ./script.sh

Leave a Reply