Screen

Linux macOS GPLv3 | Used in: SG-03

What It Does

GNU Screen is a terminal multiplexer that lets you run multiple shell sessions inside a single terminal window, detach from them, and reattach later. It also doubles as a serial console — you can connect directly to UART devices like Arduino boards, routers, and switches from the command line without any GUI application. It comes pre-installed on most Linux distributions and macOS.

Why You Need It

In Signal guide SG-03, you need to communicate with microcontrollers over a serial connection. Screen is the fastest way to open a serial terminal on Linux or macOS — one command and you are connected. Beyond serial work, screen is essential for any remote SSH session: if your connection drops, screen keeps the process running on the remote host and you can reattach when you reconnect. It is the lightweight alternative to tmux that has been shipping with Unix systems for decades.

How to Install It

Screen is pre-installed on most Linux distributions and macOS. Verify with:

screen --version

If missing (Debian/Ubuntu):

sudo apt install screen

If missing (Fedora/RHEL):

sudo dnf install screen

macOS: Screen ships with macOS. If you need a newer version:

brew install screen

Windows: Screen is not natively available on Windows. Use WSL (Windows Subsystem for Linux) to get it, or use PuTTY for serial connections on Windows.

How to Use It

  1. Serial connection — Connect to a serial device at a specific baud rate:
    screen /dev/ttyUSB0 115200

    Replace /dev/ttyUSB0 with your device path. Use ls /dev/tty* to find connected serial devices. On macOS, look for /dev/tty.usbmodem* or /dev/tty.usbserial*.

  2. Named sessions — Start a named screen session for easy identification:
    screen -S arduino-monitor
  3. Detach from a session — Press Ctrl+A then D to detach. The session keeps running in the background. Your serial connection stays open.
  4. Reattach to a session — List running sessions and reattach:
    screen -ls              # list all sessions
    screen -r arduino-monitor  # reattach by name
    screen -r 12345            # reattach by PID
  5. Kill a session — From inside the session, press Ctrl+A then type :quit. Or from outside:
    screen -X -S arduino-monitor quit

Common Gotchas

Ctrl+A collision with bash

Ctrl+A is screen's escape key, but in bash it means "go to beginning of line." Inside screen, Ctrl+A is captured by screen. To send a literal Ctrl+A to bash, press Ctrl+A then A (double-tap the A).

Serial port permission denied

If screen /dev/ttyUSB0 115200 gives "Permission denied," your user is not in the dialout group. Fix it with sudo usermod -aG dialout $USER and then log out and back in. Running screen with sudo works as a quick workaround but is not recommended long-term.

Zombie sessions after disconnect

If you close a terminal window without detaching first (Ctrl+A, D), the screen session becomes "Attached" but unreachable. Force detach and reattach with screen -dr session_name.

Exiting a serial session

Pressing Ctrl+C sends the interrupt to the serial device, it does not close screen. To exit a serial screen session, press Ctrl+A then K (kill window) and confirm with y. Or press Ctrl+A then type :quit.

Scrollback buffer

By default, you cannot scroll up with your mouse wheel inside screen. To enter scroll/copy mode, press Ctrl+A then [. Use arrow keys or Page Up/Down to scroll. Press Esc to exit scroll mode.

Last Reviewed

Last reviewed: March 2026