Screen Command
Manage Terminal Sessions with Screen
The screen command is a powerful terminal multiplexer
that allows you to manage multiple terminal sessions within a single
window. This is incredibly useful for running long processes,
keeping sessions alive after disconnecting, and organizing your
command-line work. Below are the essential commands for using
screen effectively.
Essential Screen Command Usage
Here are the most common commands to get you started with managing
your terminal sessions using screen:
# To start a new named screen session:
screen -S <session-name>
# To detach from the current session (leaves it running in the background):
Press Ctrl+A then press d
# To re-attach a detached session:
screen -r <session-name>
# To list all active screen sessions:
screen -ls
# To terminate a specific screen session:
screen -XS <session-name> quit
Understanding Screen Multiplexing
screen allows you to create, manage, and switch between
multiple virtual terminals. Each virtual terminal can run its own
process independently. This means you can start a script in one
screen session, detach from it, log out, and later re-attach to find
your script still running. It's an indispensable tool for system
administrators and developers working remotely or managing complex
server environments.
