Screen: A very handy terminal tool

Using screen on Ubuntu to Manage Long-Running Tasks

When working on remote servers through SSH, long-running commands (like backups, builds, or data imports) can easily be interrupted if your connection drops. The screen tool solves this problem by letting you create detachable terminal sessions that keep running even after you disconnect.

Create a new screen session

To start a new session named heavy-task:

# This opens a new terminal inside a managed screen session.
screen -S heavy-task

Detach from the session

If you need to close your SSH connection but keep the process running, detach from the screen by pressing:

Ctrl + A, then D

Your process keeps running in the background even after logout.

Reattach to the session later

When you reconnect to the server, list available screen sessions:

# Listing sessions
screen -ls

# Reattach to it using:
screen -r heavy-task

Bonus

When working inside a terminal (including a screen session), you might sometimes want to pause the scrolling output — for example, if logs are flying by too fast.

Linux terminals support flow control keys:

# Pause
CTRL + S

# Resume
CTRL + Q

Related Posts