macOSLinux

Where Does GNU Screen Keep Config and Sockets?

GNU Screen reads ~/.screenrc and parks session sockets in a runtime dir. Config precedence, socket paths and reattaching.

Last updated

Screen reads two configs at startup: the system /etc/screenrc first, then your ~/.screenrc. Three overrides stack above them in order: $SCREENRC, then the -c flag, which always wins. Key bindings, startup windows and defaults all come from this chain, so check each layer when a setting refuses to stick.

Live sessions live as sockets in a runtime directory (/run/screen, /tmp/screens or ~/.screen depending on the build), overridable with $SCREENDIR. screen -ls lists them; screen -r reattaches. Killed sessions sometimes leave dead sockets behind: clear them before assuming screen itself broke.

Where Screen stores this, by platform

macOS
~/.screenrc

User config; system file at /etc/screenrc. Sockets typically under /tmp/screens or ~/.screen on this platform. -c overrides everything for one-off configs.

Linux
~/.screenrc

Same precedence chain ($SCREENRC, then -c). Sockets prefer /run/screen on systemd builds, else /tmp/screens. Set SCREENDIR to a mode-700 dir for custom placement.

Frequently asked questions

Screen ignores my config, which file wins?

Precedence is /etc/screenrc, then ~/.screenrc, then $SCREENRC, then -c. Verify with screen -c /dev/null to bypass user config. A stray $SCREENRC export is the usual invisible culprit.

Where are detached Screen sessions stored?

As sockets in the runtime dir (/run/screen, /tmp/screens or ~/.screen per build, or $SCREENDIR). screen -ls shows live ones with dead ones flagged. Wipe stale sockets when reattach claims sessions that no longer run.

Notice an outdated path? Let us know.