October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk10 min

How to Install and Use GNU Screen on an Ubuntu VPS

A practical Ubuntu VPS guide to installing GNU Screen, keeping commands alive after SSH disconnects, reconnecting to named sessions, using windows and logging, and troubleshooting lost or attached sessions.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Install GNU Screen with sudo apt update followed by sudo apt install screen. Start a named session with screen -S app, run your long-lived command, and detach with Ctrl+A, then D. If SSH disconnects, log in again, run screen -ls, and reconnect with screen -r app. The command keeps running because Screen separates the virtual terminal from your SSH connection.

What GNU Screen does on an Ubuntu VPS

GNU Screen is a terminal multiplexer: it creates one or more virtual terminal windows inside a single terminal session. On a VPS, that session can continue running after you close your SSH client, lose network connectivity, or move to another terminal. You reconnect later and see the same shell and program state.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

This is useful for deployment scripts, database imports, compilers, workers, backups, and interactive administration that may take longer than an SSH connection can reliably remain open. Screen does not make a failed program reliable, and it does not protect a process from a VPS reboot; it keeps the terminal session available while the server and the command continue running.

The key operation is detaching. Pressing Ctrl+A, releasing both keys, then pressing D disconnects Screen from your current terminal without stopping the shell or command inside it. GNU’s manual identifies moving a session between terminals by detaching and reattaching as Screen’s most useful feature.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

Check your Ubuntu account and connect over SSH

Connect to the VPS with the Linux account that should own the work:

ssh username@server-address

Screen sessions belong to the account that creates them. A session created by root is not listed for a normal user, and a normal user cannot reattach to root’s session unless Unix permissions are deliberately configured to allow it. Keep the account consistent when you reconnect.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Before installing, verify that the host is the Ubuntu VPS you expect and that your account can use sudo. Package installation changes the server, so review any organization-specific maintenance or privilege policy first.

Install Screen from Ubuntu’s package repositories

  1. Refresh package metadata. Run:
sudo apt update
  1. Install the package.
sudo apt install screen

Confirm the package manager’s prompt when asked. Ubuntu publishes the screen package for supported releases. The exact build depends on the Ubuntu release and repository updates; for example, the Ubuntu Jammy manpage identifies screen as version 4.9.0-1ubuntu0.1. That Jammy value is not a universal version for every Ubuntu VPS.

  1. Verify the executable.
screen --version

The command should print the installed GNU Screen version. If it does not, first check whether installation completed successfully. A shell that was already running normally sees a newly installed executable, but opening a fresh SSH shell or refreshing the shell’s command lookup can resolve an unusual “command not found” result.

Create a recoverable named session

Use a descriptive name rather than relying on an automatically assigned identifier:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
screen -S app

You will enter a new shell inside Screen. The VPS prompt may look almost identical to an ordinary shell; the important difference is that it is now hosted by a Screen session. Names such as app, migration, backup, or deploy make recovery safer when several sessions exist.

Run the long-lived command

Start the command exactly as you would in a normal SSH shell. For example:

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.
./start-worker.sh

Keep the terminal in the Screen session while you watch startup output or respond to prompts. If the program expects environment variables, working-directory context, credentials, or a virtual environment, establish those inside Screen before launching it. Screen preserves the shell context; it does not recreate a command that you never started or supply missing configuration.

Detach without stopping the command

  1. Hold Ctrl and press A.
  2. Release both keys.
  3. Press D.

You should return to the ordinary SSH prompt and see a message indicating that the session detached. The worker remains inside Screen on the VPS. Do not type Ctrl+A and D simultaneously as a single chord; the sequence is prefix, release, command.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Reconnect after closing SSH or losing the connection

Log in to the VPS again with the same Linux account, then list sessions:

screen -ls

screen -ls (also available as screen -list) shows the session identifier, name, and whether each session is attached or detached. A typical identifier combines the process ID and name, so use the displayed value rather than guessing it.

Reattach a detached session

Reconnect by its memorable name:

screen -r app

You can also use the session ID shown by screen -ls. Once attached, you see the shell and command output where you left them. If the command is interactive, input goes to that session again.

Take over a session attached elsewhere

If Screen reports that the session is attached to another terminal, confirm that the old SSH connection is yours or is no longer usable. Then deliberately detach it there and attach here:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
screen -d -r app

The -d option detaches the existing display; -r reattaches the session to your current terminal. Do not use this as a routine substitute for checking who currently controls an important production shell.

Understand the session states

State or message Meaning Action
Detached The session is running without a terminal attached. Use screen -r name to resume it.
Attached Another terminal currently displays the session. Reconnect to that terminal or use screen -d -r name after verifying it is safe to take over.
No sessions listed No live Screen session is visible to this account. Check the username and whether the command or shell already exited.
There is no screen to be resumed The requested session no longer exists, commonly because its shell or command ended. Inspect the application’s own logs and create a new session if needed.

Use multiple virtual windows in one session

Screen’s command prefix is Ctrl+A. Press the prefix, release the keys, and then press the command key. The following controls cover normal VPS administration:

Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by
Sequence Result
Ctrl+A, then C Create a new window with a shell.
Ctrl+A, then N Move to the next window.
Ctrl+A, then P Move to the previous window.
Ctrl+A, then a number from 0 through 9 Jump to that numbered window.
Ctrl+A, then K Kill the current window. Confirm that its shell or program can be stopped.
Ctrl+A, then D Detach the entire Screen session.
Ctrl+A, then ? Display Screen’s help for available key bindings.

A practical arrangement is to keep the application in one window, logs or monitoring commands in another, and an administrative shell in a third. Detaching preserves all of those windows together, so you can return to the same layout after reconnecting.

Screen also supports copying text and viewing scrollback. Use the built-in help, Ctrl+A, then ?, when you need the exact copy-mode controls for your terminal and version.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Start commands automatically in a detached session

For a non-interactive job, create a detached, named session in one command:

screen -dmS backup sh -c 'rsync -a /srv/data /srv/backup'

Here, -d -m starts Screen detached, -S backup assigns the name, and sh -c runs the quoted command inside the session. The outer shell’s quotes matter: they pass the complete command to the shell inside Screen. Use paths and options appropriate to your server, and ensure the destination and account permissions are correct before launching a large transfer.

Inspect the job later with:

screen -ls
screen -r backup

If the command finishes, the shell may exit and the Screen session may disappear. For durable job history, rely on the command’s own logging or a service designed to supervise it; Screen is a terminal-preservation tool, not a process supervisor.

Capture terminal output with Screen logging

Start a session with automatic output logging when you need a transcript:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
screen -L -S backup

The -L option enables Screen’s automatic output logging for that session. Decide where the resulting log should be written and verify that the account can write there. Treat the file as operational data:

  • Do not print passwords, tokens, private keys, or other secrets into a logged terminal.
  • Protect log permissions so other users cannot read sensitive output.
  • Plan rotation or deletion; an unattended verbose command can consume disk space.
  • Use the application’s structured logs when you need timestamps, retention, or centralized collection.

Logging records terminal output; it does not guarantee that every application event is captured or that an interactive program will produce a useful audit trail.

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.

Share a session deliberately

screen -x session attaches to a session that is already attached elsewhere, enabling a multi-display view. Two terminals can then observe and, depending on the situation, interact with the same shell.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
screen -x app

Use this for deliberate collaboration, supervised maintenance, or a handoff where both parties understand that keyboard input affects the same process. It is not a permission bypass. Unix ownership and Screen’s access rules still apply; users need appropriate permissions to attach. Avoid sharing a shell that contains credentials or commands intended for only one operator.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Detach, stop, and clean up sessions safely

Leave a running job in the background

Use Ctrl+A, then D. Closing SSH after that is safe for the Screen session, provided the VPS remains available and the command itself continues running.

Stop a session normally

Reattach to it, stop the application using its documented shutdown method, and then exit the shell:

screen -r app
# stop the program inside Screen
exit

After the shell exits, check:

screen -ls

The session should no longer be listed. Killing a window with Ctrl+A, then K, also terminates that window’s shell and any foreground command, so use it only when that interruption is intended.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Remove stale entries

If screen -ls shows entries for sessions that are genuinely dead, inspect the process first. Then clean stale records with:

screen -wipe

Do not run screen -wipe as a substitute for checking; it is intended to remove entries that no longer correspond to live sessions.

Troubleshoot common Ubuntu VPS problems

“screen: command not found”

  • Install the package with sudo apt update and sudo apt install screen.
  • Run screen --version to verify installation.
  • If installation just completed, open a fresh shell or refresh the current shell’s command lookup.

No sessions appear in screen -ls

Confirm the Linux username with whoami and reconnect as the account that created the session. Root and normal-user sessions are separate. If the account is correct, the command may have exited, the shell may have received an exit, or the VPS may have rebooted. Check the program’s own logs and start a new named session.

“There is no screen to be resumed”

The named or numbered session is gone. A Screen session normally depends on its shell; when the shell and its final command end, there is nothing to reattach. Inspect application output or logs for an error instead of repeatedly trying screen -r.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The session is attached elsewhere

Find the old terminal if possible. If it is yours and should relinquish control, run screen -d -r name from the new SSH connection. If another operator is using it, coordinate before taking over so you do not interrupt an interactive command.

The terminal display is garbled or the size is wrong

A terminal-size mismatch can occur after changing clients or window dimensions. Reattach with Screen’s adaptation option:

screen -A -r app

The -A option adapts Screen windows to the current display size. If the problem persists, detach and reconnect from a terminal with a conventional UTF-8 and terminal-type configuration, then inspect the application’s own terminal assumptions.

The SSH connection dropped and the command stopped

First check screen -ls. If the session is present, reattach; the disconnect was only a transport interruption. If no session remains, the command may have been started outside Screen, may have exited on its own, or the VPS may have rebooted. Screen’s default autodetach on hangup helps preserve a live Screen session, but it cannot resurrect a process that crashed or a machine that was powered off.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Disk usage grows unexpectedly

Check whether Screen logging is enabled and whether a command is producing continuous output. Move, rotate, or remove logs according to your retention policy, and disable logging when a transcript is no longer required. Never delete a log while a critical investigation depends on it without preserving the needed copy.

A repeatable workflow for production tasks

  1. SSH to the VPS using the account that owns the work.
  2. Run screen -ls before creating anything, so you do not start a duplicate job.
  3. Create a descriptive session, such as screen -S migration.
  4. Change to the intended directory and load required environment settings inside Screen.
  5. Start the command and verify its initial output.
  6. Detach with Ctrl+A, then D.
  7. Record the session name and the command in your operational notes.
  8. Reconnect later with screen -r migration; use screen -d -r migration only when taking over an attached session intentionally.
  9. After completion, stop the command cleanly, exit the shell, and confirm that screen -ls no longer lists an unnecessary session.

This workflow prevents the two most common operational mistakes: launching the same task twice and losing track of which account owns the running session.

Screen’s limits and when to use another mechanism

Screen is appropriate when you need an interactive terminal that can survive an SSH disconnect. It is not a replacement for a service manager, scheduler, queue worker supervisor, or backup system. A VPS reboot, kernel failure, out-of-memory termination, application crash, or command-line mistake can still stop the work. For software that must restart automatically, start at boot, expose health status, or maintain structured logs, configure an appropriate service or job system in addition to—or instead of—Screen.

For a one-time command, Screen gives you a simple recovery path. For a persistent production workload, pair it with application-level logging, explicit timeouts, monitoring, and a documented restart procedure.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.