{"tool":"screen","name":"GNU Screen","description":"The original terminal multiplexer: detachable sessions, multiple windows and serial-console access.","tags":["terminal","sessions","serial"],"homepage":"https://www.gnu.org/software/screen/","docs":"https://www.gnu.org/software/screen/manual/screen.html","install":{"apt":"sudo apt install screen","brew":"brew install screen"},"related":["tmux","ssh"],"total_commands":100,"commands":[{"id":1,"category":"Basic Syntax","command":"screen","example":"screen","explanation":"Starts a new screen session with default settings."},{"id":2,"category":"Basic Syntax","command":"screen -version","example":"screen -version","explanation":"Displays the installed version of GNU Screen."},{"id":3,"category":"Basic Syntax","command":"screen -help","example":"screen -help","explanation":"Prints a summary of command-line options and flags."},{"id":4,"category":"Session Management","command":"screen -ls","example":"screen -ls","explanation":"Lists all currently active screen sessions and their sockets."},{"id":5,"category":"Session Management","command":"screen -S [name]","example":"screen -S deployment_ops","explanation":"Starts a new session with a specific descriptive name."},{"id":6,"category":"Session Management","command":"screen -r [id]","example":"screen -r 12345","explanation":"Reattaches to a detached session using its process ID."},{"id":7,"category":"Session Management","command":"screen -r [name]","example":"screen -r deployment_ops","explanation":"Reattaches to a detached session using its session name."},{"id":8,"category":"Session Management","command":"screen -R","example":"screen -R my_session","explanation":"Reattaches to an existing session or creates it if it does not exist."},{"id":9,"category":"Session Management","command":"screen -d [name]","example":"screen -d deployment_ops","explanation":"Remotely detaches a session that is currently attached elsewhere."},{"id":10,"category":"Session Management","command":"screen -d -r [name]","example":"screen -d -r deployment_ops","explanation":"Detaches a session from another terminal and reattaches it to the current one."},{"id":11,"category":"Session Management","command":"screen -x [name]","example":"screen -x joint_session","explanation":"Attaches to a session without detaching it elsewhere for multi-display mode."},{"id":12,"category":"Session Management","command":"screen -wipe","example":"screen -wipe","explanation":"Removes dead or crashed session sockets from the socket directory."},{"id":13,"category":"Internal Navigation","command":"Ctrl+a ?","example":"Press Ctrl+a then ?","explanation":"Displays a list of current key bindings and commands."},{"id":14,"category":"Internal Navigation","command":"Ctrl+a d","example":"Press Ctrl+a then d","explanation":"Detaches the current session and returns to the shell."},{"id":15,"category":"Window Management","command":"Ctrl+a c","example":"Press Ctrl+a then c","explanation":"Creates a new window within the current screen session."},{"id":16,"category":"Window Management","command":"Ctrl+a n","example":"Press Ctrl+a then n","explanation":"Switches to the next window in the list."},{"id":17,"category":"Window Management","command":"Ctrl+a p","example":"Press Ctrl+a then p","explanation":"Switches to the previous window in the list."},{"id":18,"category":"Window Management","command":"Ctrl+a [0-9]","example":"Press Ctrl+a then 1","explanation":"Switches directly to the window with the specified number."},{"id":19,"category":"Window Management","command":"Ctrl+a \"","example":"Press Ctrl+a then \"","explanation":"Displays an interactive list of all windows for selection."},{"id":20,"category":"Window Management","command":"Ctrl+a w","example":"Press Ctrl+a then w","explanation":"Displays a list of windows on the status line."},{"id":21,"category":"Window Management","command":"Ctrl+a A","example":"Press Ctrl+a then A","explanation":"Prompts to rename the current window title."},{"id":22,"category":"Window Management","command":"Ctrl+a k","example":"Press Ctrl+a then k","explanation":"Kills the current window and its running process."},{"id":23,"category":"Window Management","command":"Ctrl+a \\","example":"Press Ctrl+a then \\","explanation":"Kills all windows and terminates the screen session immediately."},{"id":24,"category":"Region Management","command":"Ctrl+a S","example":"Press Ctrl+a then S","explanation":"Splits the current region horizontally into two regions."},{"id":25,"category":"Region Management","command":"Ctrl+a |","example":"Press Ctrl+a then |","explanation":"Splits the current region vertically into two regions."},{"id":26,"category":"Region Management","command":"Ctrl+a Tab","example":"Press Ctrl+a then Tab","explanation":"Switches input focus to the next region."},{"id":27,"category":"Region Management","command":"Ctrl+a Q","example":"Press Ctrl+a then Q","explanation":"Closes all regions except the currently focused one."},{"id":28,"category":"Region Management","command":"Ctrl+a X","example":"Press Ctrl+a then X","explanation":"Closes the currently focused region."},{"id":29,"category":"Copy and Scroll","command":"Ctrl+a [","example":"Press Ctrl+a then [","explanation":"Enters copy/scrollback mode to view history or select text."},{"id":30,"category":"Copy and Scroll","command":"Ctrl+a ]","example":"Press Ctrl+a then ]","explanation":"Pastes the contents of the screen buffer into the current input."},{"id":31,"category":"Copy and Scroll","command":"Ctrl+a >","example":"Press Ctrl+a then >","explanation":"Writes the current paste buffer to a temporary file."},{"id":32,"category":"Configuration","command":"screen -c [file]","example":"screen -c .screenrc_custom","explanation":"Starts a session using a specific configuration file."},{"id":33,"category":"Configuration","command":"Ctrl+a :source","example":"Press Ctrl+a :source .screenrc","explanation":"Reloads the configuration file into the current session."},{"id":34,"category":"Logging","command":"screen -L","example":"screen -L -S monitored_session","explanation":"Starts a session with automatic output logging enabled."},{"id":35,"category":"Logging","command":"screen -Logfile [file]","example":"screen -L -Logfile session.log","explanation":"Defines the specific filename for the session output log."},{"id":36,"category":"Logging","command":"Ctrl+a H","example":"Press Ctrl+a then H","explanation":"Toggles logging on or off for the current window."},{"id":37,"category":"Logging","command":"Ctrl+a h","example":"Press Ctrl+a then h","explanation":"Writes a hardcopy of the current view to a file."},{"id":38,"category":"Security","command":"Ctrl+a x","example":"Press Ctrl+a then x","explanation":"Locks the screen terminal requiring a password to unlock."},{"id":39,"category":"Automation","command":"screen -d -m [cmd]","example":"screen -d -m ./start_server.sh","explanation":"Starts a session in detached mode running a specific command."},{"id":40,"category":"Automation","command":"screen -X [cmd]","example":"screen -S session_name -X quit","explanation":"Sends a command to a running screen session without attaching."},{"id":41,"category":"Automation","command":"screen -X stuff","example":"screen -S sess -X stuff 'ls^M'","explanation":"Injects keystrokes or strings into a running session window."},{"id":42,"category":"Automation","command":"screen -X screen","example":"screen -S sess -X screen top","explanation":"Creates a new window running a command in a remote session."},{"id":43,"category":"Advanced Config","command":"defscrollback [num]","example":"Add 'defscrollback 10000' to .screenrc","explanation":"Sets the default scrollback buffer size for new windows."},{"id":44,"category":"Advanced Config","command":"escape [key]","example":"Add 'escape ^Bb' to .screenrc","explanation":"Changes the command character from Ctrl-a to Ctrl-b."},{"id":45,"category":"Advanced Config","command":"hardstatus alwayslastline","example":"Add 'hardstatus alwayslastline' to .screenrc","explanation":"Configures the status bar to always appear at the bottom."},{"id":46,"category":"Advanced Config","command":"startup_message off","example":"Add 'startup_message off' to .screenrc","explanation":"Disables the copyright notice screen on startup."},{"id":47,"category":"Multi-User","command":"multiuser on","example":"Press Ctrl+a :multiuser on","explanation":"Enables multi-user mode for the current session."},{"id":48,"category":"Multi-User","command":"acladd [user]","example":"Press Ctrl+a :acladd operator1","explanation":"Grants a specific user permission to access the session."},{"id":49,"category":"Multi-User","command":"acldel [user]","example":"Press Ctrl+a :acldel operator1","explanation":"Revokes a user's permission to access the session."},{"id":50,"category":"Multi-User","command":"aclchg [user] [perms]","example":"Press Ctrl+a :aclchg operator1 -w","explanation":"Modifies user permissions to read-only or write access."},{"id":51,"category":"Internal Command","command":"Ctrl+a :number","example":"Press Ctrl+a :number 5","explanation":"Changes the current window's number to the specified value."},{"id":52,"category":"Internal Command","command":"Ctrl+a :title","example":"Press Ctrl+a :title 'Database'","explanation":"Renames the current window via the command prompt."},{"id":53,"category":"Internal Command","command":"Ctrl+a :fit","example":"Press Ctrl+a :fit","explanation":"Resizes the window to the current region size."},{"id":54,"category":"Operational Workflow","command":"screen -q","example":"screen -q -ls","explanation":"Suppresses error messages for cleaner script output."},{"id":55,"category":"Operational Workflow","command":"Ctrl+a t","example":"Press Ctrl+a then t","explanation":"Displays the system time and load average."},{"id":56,"category":"Operational Workflow","command":"Ctrl+a v","example":"Press Ctrl+a then v","explanation":"Display the version and compilation date."},{"id":57,"category":"Operational Workflow","command":"Ctrl+a Z","example":"Press Ctrl+a then Z","explanation":"Resets the virtual terminal to its default state."},{"id":58,"category":"Operational Workflow","command":"Ctrl+a *","example":"Press Ctrl+a then *","explanation":"Lists all currently connected displays."},{"id":59,"category":"Operational Workflow","command":"Ctrl+a _","example":"Press Ctrl+a then _","explanation":"Monitors the window for silence (inactivity)."},{"id":60,"category":"Operational Workflow","command":"Ctrl+a M","example":"Press Ctrl+a then M","explanation":"Monitors the window for activity or output."},{"id":61,"category":"SOC Workflow","command":"screen -D -m","example":"screen -D -m ./honeypot.sh","explanation":"Starts a session detached and doesn't fork a new process."},{"id":62,"category":"SOC Workflow","command":"Ctrl+a :logfile","example":"Press Ctrl+a :logfile /var/log/screen.log","explanation":"Changes the log filename dynamically while running."},{"id":63,"category":"SOC Workflow","command":"Ctrl+a :log on","example":"Press Ctrl+a :log on","explanation":"Forces logging on for evidence collection immediately."},{"id":64,"category":"Blue Team Defense","command":"screen -x -X lockscreen","example":"screen -x session_name -X lockscreen","explanation":"Remotely locks a shared session to prevent unauthorized input."},{"id":65,"category":"Blue Team Defense","command":"vbell off","example":"Add 'vbell off' to .screenrc","explanation":"Disables the visual bell flash for stealthier operation."},{"id":66,"category":"Blue Team Defense","command":"screen -S [name] -p [win] -X kill","example":"screen -S incident -p 2 -X kill","explanation":"Remotely kills a specific window in a session without attaching."},{"id":67,"category":"Scripting","command":"screen -p [n] -X stuff","example":"screen -S main -p 0 -X stuff $'ls\\n'","explanation":"Sends a shell command to window 0 of a detached session."},{"id":68,"category":"Scripting","command":"screen -Q windows","example":"screen -S main -Q windows","explanation":"Queries a detached session for a list of active windows."},{"id":69,"category":"Scripting","command":"screen -X eval","example":"screen -X eval 'split' 'focus' 'screen'","explanation":"Executes multiple screen commands sequentially in one call."},{"id":70,"category":"Scripting","command":"screen -X readreg","example":"screen -X readreg p /tmp/buffer","explanation":"Reads the contents of a file into a screen paste register."},{"id":71,"category":"Scripting","command":"screen -X paste","example":"screen -X paste p","explanation":"Pastes contents from a specific register into the window."},{"id":72,"category":"Incident Response","command":"screen -S [name] -X hardcopy -h [file]","example":"screen -S breach -X hardcopy -h /tmp/dump","explanation":"Saves the full scrollback buffer to a file for forensics."},{"id":73,"category":"Incident Response","command":"Ctrl+a :sessionname","example":"Press Ctrl+a :sessionname investigation_01","explanation":"Renames the current session to reflect incident status."},{"id":74,"category":"Incident Response","command":"Ctrl+a :wrap","example":"Press Ctrl+a :wrap on","explanation":"Toggles line wrapping to preserve long log lines."},{"id":75,"category":"Environment","command":"setenv [var] [val]","example":"Add 'setenv PROMPT_COMMAND history -a' to .screenrc","explanation":"Sets an environment variable for all new windows."},{"id":76,"category":"Environment","command":"unsetenv [var]","example":"Add 'unsetenv SSH_AUTH_SOCK' to .screenrc","explanation":"Removes an environment variable for security isolation."},{"id":77,"category":"Advanced Workflow","command":"layout save [name]","example":"Press Ctrl+a :layout save monitoring","explanation":"Saves the current split region layout configuration."},{"id":78,"category":"Advanced Workflow","command":"layout load [name]","example":"Press Ctrl+a :layout load monitoring","explanation":"Restores a previously saved split region layout."},{"id":79,"category":"Advanced Workflow","command":"layout autosave on","example":"Press Ctrl+a :layout autosave on","explanation":"Automatically saves the layout when changes occur."},{"id":80,"category":"Advanced Workflow","command":"bind [key] [cmd]","example":"Add 'bind k kill' to .screenrc","explanation":"Binds a specific key to a screen command."},{"id":81,"category":"Advanced Workflow","command":"bindkey [seq] [cmd]","example":"Add 'bindkey -k F1 prev' to .screenrc","explanation":"Binds a keyboard function key to a screen command."},{"id":82,"category":"Advanced Workflow","command":"screen -X colon","example":"screen -X colon","explanation":"Forces the session to enter the command prompt mode."},{"id":83,"category":"Buffer Management","command":"Ctrl+a =","example":"Press Ctrl+a then =","explanation":"Removes the current paste buffer."},{"id":84,"category":"Buffer Management","command":"writebuf","example":"Press Ctrl+a :writebuf /tmp/screen-exchange","explanation":"Writes the paste buffer to the exchange file."},{"id":85,"category":"Buffer Management","command":"readbuf","example":"Press Ctrl+a :readbuf /tmp/screen-exchange","explanation":"Reads the exchange file into the paste buffer."},{"id":86,"category":"Flow Control","command":"Ctrl+a f","example":"Press Ctrl+a then f","explanation":"Toggles flow control to fix frozen terminals."},{"id":87,"category":"Flow Control","command":"defflow","example":"Add 'defflow off' to .screenrc","explanation":"Sets default flow control behavior for new windows."},{"id":88,"category":"Character Encoding","command":"defutf8 on","example":"Add 'defutf8 on' to .screenrc","explanation":"Enables UTF-8 encoding by default for new windows."},{"id":89,"category":"Character Encoding","command":"Ctrl+a :utf8 on","example":"Press Ctrl+a :utf8 on","explanation":"Toggles UTF-8 encoding for the current window."},{"id":90,"category":"Session Hierarchy","command":"Ctrl+a a","example":"Press Ctrl+a then a","explanation":"Sends a literal Ctrl+a to the application inside screen."},{"id":91,"category":"Session Hierarchy","command":"screen -e^xx","example":"screen -e^xx","explanation":"Starts screen with Ctrl+x as the escape character for nested sessions."},{"id":92,"category":"Advanced Scripting","command":"screen -X at","example":"screen -X at 2 stuff 'exit^M'","explanation":"Executes a command specifically in window number 2."},{"id":93,"category":"Advanced Scripting","command":"screen -X other","example":"screen -X other","explanation":"Switches the window to the previously used window."},{"id":94,"category":"Advanced Scripting","command":"screen -X remove","example":"screen -X remove","explanation":"Destroys the current region in split mode remotely."},{"id":95,"category":"Advanced Scripting","command":"screen -X select","example":"screen -X select 0","explanation":"Forces the session to switch to window 0."},{"id":96,"category":"Real World Ops","command":"zombie [keys]","example":"Add 'zombie kr' to .screenrc","explanation":"Keeps windows open after the process dies for inspection."},{"id":97,"category":"Real World Ops","command":"autodetach on","example":"Add 'autodetach on' to .screenrc","explanation":"Automatically detaches the session on SIGHUP instead of terminating."},{"id":98,"category":"Real World Ops","command":"pow_detach_msg","example":"Add 'pow_detach_msg none' to .screenrc","explanation":"Disables the message displayed when detaching."},{"id":99,"category":"Real World Ops","command":"msgminwait 0","example":"Add 'msgminwait 0' to .screenrc","explanation":"Reduces the wait time for status messages to zero."},{"id":100,"category":"Advanced Workflow","command":"screen -r [name] -X","example":"screen -r session -X eval 'split' 'focus' 'screen top'","explanation":"Reattaches and immediately executes a sequence of commands."}],"slug":"screen","category":"utilities","url":"https://terminal.rokibulroni.com/tool/utilities/screen","markdown":"https://terminal.rokibulroni.com/api/v1/tools/utilities/screen.md"}