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

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

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 press Ctrl-A, then d to detach. The command continues on the VPS after you close SSH; log in again and run screen -r app to continue where you left off.

What GNU Screen does on an Ubuntu VPS

GNU Screen is a terminal multiplexer: it creates virtual terminals inside one terminal window or remote connection. Over SSH, that means you can run a shell, worker, backup, deployment, or other long-lived command in a Screen session and disconnect without automatically ending the session. You can later reconnect to the same virtual terminal from a new SSH login.

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

A Screen session has one or more windows. Each window behaves like a separate full-screen terminal, while the session itself can be detached from your current terminal. Detaching is different from stopping a process: the shell and its foreground command remain active on the VPS. Reattaching restores the terminal view, including the session’s windows and scrollback that Screen still has available.

Screen protects you from an ordinary SSH interruption, but it is not a process supervisor. If the command inside the session exits, crashes, or is terminated, Screen does not restart it. For services that must restart automatically after a reboot or failure, use an appropriate service manager; use Screen when you need an interactive terminal that can survive disconnection.

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application:Upgraded attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Warranty & Support: Our Electric air duster comes with 5 years warranty and 24/7 customer service. During this period, if you have any questions,pls kindly feel free to contact us.

Prerequisites and package installation

  • An Ubuntu VPS that you can reach over SSH.
  • A user account with sudo rights, or an account allowed to install packages.
  • The same Linux account later used to reconnect to the session. Screen sessions are associated with their owning user.

Ubuntu provides the screen package through its normal package repositories. Package versions depend on the Ubuntu release. For example, the Ubuntu Jammy manpage identifies screen as version 4.9.0-1ubuntu0.1; that number is a Jammy example, not a universal version for every release.

  1. Connect to the VPS:
ssh your-user@your-vps
  1. Refresh the local package metadata:
sudo apt update
  1. Install GNU Screen:
sudo apt install screen

When prompted, confirm the installation. Then verify that the executable is available:

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

The output should identify GNU Screen and the version supplied by your Ubuntu release. If the command is still unavailable immediately after installation, start a new shell or reconnect over SSH so the shell refreshes its command lookup.

Create and use your first Screen session

Start a named session

Names are easier to recognize than numeric IDs, especially when several jobs run on one VPS. Create a session called app with:

screen -S app

Screen clears or redraws the terminal and presents a shell inside the new session. The command prompt may look much like an ordinary SSH shell; the important difference is that it is now inside Screen.

Run the long-lived command inside Screen

Start the command only after Screen has opened. For example:

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.
./start-worker.sh

Keep this SSH window open while you test that the command starts correctly. Screen does not alter the command’s arguments, environment, files, or permissions; it supplies a persistent terminal around the process.

Detach without stopping the command

Screen uses Ctrl-A as its command prefix. To detach, press and release Ctrl-A, then press d:

Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth
Ctrl-A d

You should return to the outer SSH shell and see a message indicating that the session was detached. The command continues in the background of the VPS. You can now close SSH safely; closing the client after detaching does not terminate the Screen session.

List, reattach, and take over sessions after SSH drops

List sessions

After logging in again, inspect the sessions owned by your current Linux user:

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

The listing shows each session’s numeric identifier, name, and state. A typical entry contains a value similar to 24831.app; both the complete identifier and the name can be used for reattachment.

Reattach by name or ID

Use the name when you assigned one:

screen -r app

You can also use the session identifier shown by screen -ls:

screen -r 24831

Once attached, you are back at the session’s current window. The foreground command is still running if it has not exited, and you can interact with it normally.

Resolve an “attached elsewhere” message

If the previous SSH connection did not detach cleanly, Screen may report that the session is attached to another terminal. First make sure that the other terminal is yours and that moving control is intentional. Then run:

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 session from its existing terminal; -r immediately reattaches it to your current terminal. Do not use this command to seize a session that another administrator is actively using unless you have agreed on the hand-off.

Use the same Linux account that created the session. A session created as root is not shown in the normal user’s screen -ls output, and a normal user cannot reattach to it merely by knowing its name.

Rank #3
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.

Navigate Screen windows

One Screen session can contain multiple virtual windows. The command prefix is always Ctrl-A; release those keys before pressing the second key.

Key sequence Action When to use it
Ctrl-A c Create a new window Open another shell or tool without leaving the session.
Ctrl-A n Next window Move forward through the session’s windows.
Ctrl-A p Previous window Move backward through the windows.
Ctrl-A 0 through Ctrl-A 9 Jump to a numbered window Go directly to one of the first ten windows.
Ctrl-A k Kill the current window Close the window and its shell after confirming the prompt.
Ctrl-A d Detach Leave every window running while returning to the outer shell.
Ctrl-A ? Show help Display Screen’s built-in command list.

Each window has its own shell or program. Switching windows does not pause the programs in the other windows. This makes one named session useful for related interactive tasks, such as watching a worker in one window and inspecting files in another.

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

Start jobs non-interactively with Screen

Launch a detached job in one command

For a command that does not need an interactive prompt, create the session and detach it immediately:

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

Here, -d -m starts Screen detached, -S backup assigns the session name, and sh -c runs the quoted command inside the session. The command returns control to your current shell instead of opening an interactive Screen display.

Check that the job started:

screen -ls

To watch its output interactively, reattach:

screen -r backup

When the command finishes, its shell may exit and the Screen session may disappear. That is expected for a one-shot job. If you need a persistent shell after the command, start an interactive shell explicitly or run the command from an already interactive named session.

Quote commands carefully

The command following the Screen options is interpreted by the shell you invoke. Keep the complete command in single quotes when it contains spaces, pipes, redirections, or shell operators. Test complicated quoting in a normal shell first; Screen does not provide a separate error-recovery layer for a malformed command line.

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

Capture output with Screen logging

Screen can automatically log terminal output. Start a session with the logging option:

screen -L -S backup

-L enables automatic output logging for that Screen session. The exact log file location and naming behavior depend on Screen’s configuration and current working context, so check where the file is created before relying on it operationally.

Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.
  • Choose a directory where the account running Screen can write.
  • Do not allow passwords, access tokens, private keys, or other secrets to be printed into the terminal; logging can preserve them in plain text.
  • Treat logs as operational data: set an appropriate retention period and rotate or remove old files.
  • Verify that logging is actually receiving the output you need, especially when a program writes directly to a file or uses a separate logging system.

Logging records terminal output; it does not make a failed command reliable or guarantee that every application-level event is captured.

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

Share a session deliberately

Screen supports multi-display mode. The command:

screen -x app

attaches to a session that is already attached elsewhere, allowing displays to view and interact with the same windows. Ubuntu documents this as a sharing feature when the users have the necessary permissions.

Use sharing as an explicit collaboration choice, not as an access-control bypass. Unix ownership and permissions still govern who can access the session. Before attaching, confirm that everyone connected understands that keystrokes and visible terminal output are shared; another participant can type commands into the same shell.

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

Troubleshoot common Ubuntu VPS problems

screen: command not found

The package is not installed in the current environment, or the shell has not refreshed its command lookup. Run:

sudo apt update
sudo apt install screen
screen --version

If installation completed but the command is still not found, open a new shell or reconnect over SSH. Also confirm that you installed Screen on the VPS, not only on your local computer.

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.

screen -ls shows no sessions

Check the account shown by whoami and compare it with the account that created the session. Root and ordinary-user sessions are separate. If the account is correct, the session may have ended rather than merely detached.

“There is no screen to be resumed”

This means Screen cannot find a live session matching the name or ID. The shell or the command inside it may have exited. Inspect the command’s own log files or application status, then create a new named session before restarting it.

The session remains attached

A dropped SSH connection can leave Screen believing that the old terminal is still connected. Confirm that you are not about to interrupt another active user, then use:

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.
screen -d -r app

If control should remain with the other terminal, reconnect there instead of forcing a detach.

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

The terminal is garbled or the size is wrong

Terminal dimensions can change when you reconnect from a different client. GNU Screen supports adapting its window size with the -A option. For example, reattach while asking Screen to fit the current display:

screen -A -r app

You can also resize or redraw from your terminal emulator. If only the display is corrupted, detach and reattach; this refreshes the Screen view without intentionally stopping the program.

Stop a session and clean up stale entries

To stop a running interactive session, reattach to it and exit the command or shell normally. Then verify that it is gone:

screen -ls

If screen -ls contains entries for sessions that are already dead, inspect the list carefully and then remove stale records with:

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

Run screen -wipe only after checking that the listed sessions are genuinely dead; it is a cleanup operation, not a way to stop a live process.

A reliable workflow for deployments and maintenance

  1. SSH to the VPS using the account that should own the work.
  2. List existing sessions with screen -ls before creating a duplicate job.
  3. Create a descriptive session, such as screen -S deploy-api.
  4. Run the command and watch its initial output for errors.
  5. Detach with Ctrl-A d once the command is confirmed to be running.
  6. Record the session name in your change notes so another authorized operator can find it.
  7. After reconnecting, run screen -ls and then screen -r deploy-api.
  8. When the work is complete, stop the command cleanly, exit the shell if appropriate, and confirm that the session no longer appears.

This workflow avoids two common mistakes: starting the same job twice because an existing session was overlooked, and assuming that a detached session will remain forever after its command has already exited.

Screen command reference

Command Purpose
screen Open an unnamed interactive session.
screen -S name Open an interactive session with a memorable name.
screen -ls or screen -list List sessions visible to the current user.
screen -r name-or-id Reattach a detached session.
screen -d -r name-or-id Detach the session elsewhere and reattach it here.
screen -dmS name command Start a named session detached and run a command.
screen -L -S name Start a named session with automatic output logging.
screen -x name Attach to a session already displayed elsewhere, subject to permissions.
screen -A -r name-or-id Reattach while adapting the Screen window to the current terminal size.
screen -wipe Remove entries for sessions that are confirmed dead.

What Screen does not protect against

  • Command failure: a process that exits remains exited; Screen does not restart it.
  • VPS shutdown or reboot: a normal Screen session is not a boot-time service.
  • Resource exhaustion: an out-of-memory event, full disk, or other system failure can terminate the command.
  • Unauthorized access: anyone who can log in as the owning user, or who has equivalent administrative access, may be able to reach the session.
  • Secret handling: visible terminal output and optional logs can expose credentials.

Use Screen for recoverable interactive administration and one-off jobs. Pair it with application-level logging and a proper service-management strategy when availability, restart behavior, or auditability is a requirement.

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.

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