Cheatsheet: GNU Screen

Basic Commands

Start a new screen session

screen

Start a new session with a specific name

screen -S <session_name>

List running screen sessions

screen -ls

Attach to a detached session

screen -r <session_name>

Detach from a session

Ctrl + a d

Managing Windows

Create a new window

Ctrl + a c

Switch to the next window

Ctrl + a n

Switch to the previous window

Ctrl + a p

Close the current window

Ctrl + a k

Split the current window vertically

Ctrl + a |

Miscellaneous

Reattach a session with multiple users

screen -x <session_name>

Send a command to a specific window

screen -X -p <window_number> <command>

Lock the screen session

Ctrl + a x

Installation

Install with yum (CentOS/RHEL)

sudo yum install screen

Install with apt (Debian/Ubuntu)

sudo apt-get install screen

Install with brew (Mac)

brew install screen