Screen
is a tool found only on Linux and highly useful for server configuration and management by a team. It allows users to create, manage, and detach terminal sessions, which can continue running in the background even if the connection to the server is interrupted. Below is a guide for proper use.
screen
comes preinstalled. If not, you can install it with:
CTRL
+ A
+ D
screen -r name
screen -ls
Ctrl + A
then N
(next) or P
(previous)
exit
Ctrl + A
followed by the window number, e.g., Ctrl + A 0
screen -X -S session_name kill
screen -ls
kill -9
is a forced close, so the screen will close immediately, whatever its state (useful in case of a crash), but nothing will be saved upon closing
When to use killall screen
: This command should be used as a last resort, as it will terminate all active and detached screen sessions for all users on the system. It’s best used when screens are unresponsive or left open by mistake, especially if you have administrative rights and need to close lingering sessions.
quit
first to allow programs to exit gracefully, and reserve forced termination for unresponsive sessions only.