We have screen running applications in production. (I have a feeling some may recommend against it, but it does work well for us, however ...) If I scroll up in copy mode and then detach, forgetting to exit copy mode, the application blocks (I think after some time has elapsed).

What I believe is happening is the screen buffer gets filled up and cannot empty due to the active copy mode. This causes the running program to hang until reentering screen and exiting copy mode. I have made this mistake a number of times. Is there a way to prevent it? (e.g. automatically exiting copy mode when detaching, or being unable to detach whilst in copy mode). If not what about tmux or another drop in alternative?

2 Answers 2


Put a line with

defnonblock on

in ~/.screenrc

Also recommend

defflow off

to pass Ctrl-Q and Ctrl-S to applications instead of blocking screen output.


I suspect there is no solution without modifying screen, but I made this scroll.py script to at least demonstrate the problem:

#!/usr/bin/env python3
import time
with open("/tmp/scroll", mode="w") as f:
    t1 = time.time()
    while True:
        t2 = time.time()
        tdiff = t2 - t1
        t1 = t2
        text = f"tdiff={tdiff} {'!!!!!!!!' if tdiff > 0.5 else ''}"
        print(text, flush=True)
        print(text, flush=True, file=f)

Run ./scroll.py in a screen session, and tail -f /tmp/scroll in another terminal. Press Ctrl-A ESC to enter copy mode. After a few seconds, the tail output freezes, and exiting copy mode generates this output:

tdiff=5.808627605438232 !!!!!!!!

Bug report: https://savannah.gnu.org/bugs/index.php?63341

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .