When to use screen
Use screen to keep an interactive server workspace separate from the lifetime of an SSH connection. The session lives on that server and account; reconnect to the same host before trying to reattach.
Syntax
screen [PARAMETERS]Square brackets mark optional arguments; an ellipsis means repetition. Replace example file names, user names and server addresses with your own values.
Common options and arguments
Usage examples
Create a work session
screen -S maintenanceA named screen session starts, providing a persistent terminal workspace.
Show your sessions
screen -lsExisting sessions for the account are listed.
Return to session
screen -r maintenanceThe named session is reattached if its state and permissions allow it.
Notes and limitations
- To disconnect, Ctrl+A is usually used, then D; running tasks remain in the session.
- The utility may require separate installation. Make sure you are connecting to your own and not someone else's administrative session.
Common questions and troubleshooting
How do I disconnect without ending the session?
The usual default is Ctrl+A followed by D to detach. Exiting the shell inside the session instead can end that workspace.
Will screen survive a server reboot?
No ordinary screen session survives a reboot or account process termination. Use a service manager for workloads requiring supervised restart.
Further help
Options vary by version and distribution. Check the installed documentation with this command: man screen.