GNU Screen is a terminal multiplexer that lets you run multiple shell sessions inside a single terminal window, detach them, and reattach later.
screen screen -S session_name screen -ls screen -r session_name screen -r screen -X -S session_name quit Default prefix key:
Ctrl-a(press before other keys)
| Key Binding | Action |
|---|---|
Ctrl-a c | Create new window |
Ctrl-a n | Next window |
Ctrl-a p | Previous window |
Ctrl-a " | List all windows |
Ctrl-a 0..9 | Switch to window by number |
Ctrl-a A | Rename current window |
Ctrl-a d | Detach session |
Ctrl-a ? | Help (show key bindings) |
Ctrl-a k | Kill current window |
Ctrl-a \ | Kill all windows & exit screen |
Ctrl-a x | Lock screen |
Ctrl-a S | Split screen horizontally |
| `Ctrl-a | ` |
Ctrl-a tab | Switch focus between regions |
Ctrl-a Q | Close all regions except current |
Ctrl-a S Ctrl-a | Ctrl-a tab Ctrl-a Q Ctrl-a d screen -r session_name ~/.screenrc.screenrc:# Start with a named session startup_message off defscrollback 5000 hardstatus alwayslastline hardstatus string '%{= kG}[%H] %{= kw}%?%-Lw%?%{= kR}%n*%f %t%?(%u)%?%{= kw}%?%+Lw%? %{= kG}[%H]' screen -h 5000 screen -dmS session_name command Ctrl-a H (toggle logging in current window)Ctrl-a k Ctrl-a \ exit.screen -S) to avoid confusion..screenrc to customize behavior and status line.