software:cli:screen
Table of Contents
- Share a screen session:
in one terminalscreen -S SharedSession
in another terminal
screen -x SharedSession
Require same user.
See https://www.howtoforge.com/sharing-terminal-sessions-with-tmux-and-screen for more details and tmux examples - Logging:
To save everything that is in your screen session, at the beginning:Ctrl + a + h
- Detach a screen inside a screen:
Ctrl + a + a + d
- Serial console:
screen /dev/ttyS0 19200
CheatSheet
Here's a quick cheatsheet for GNU Screen with start/reconnect commands and main key bindings:
Starting and Reconnecting
Start a new screen session:
screen
Start a named screen session:
screen -S session_name
Reconnect to a detached session:
screen -r
List running sessions:
screen -ls
Reconnect to a specific session:
screen -r session_name
Main Key Bindings (defaults)
All commands are prefixed with `Ctrl+a` (denoted as `C-a` below)
Window Management:
- `C-a c`: Create a new window
- `C-a n`: Switch to next window
- `C-a p`: Switch to previous window
- `C-a 0-9`: Switch to window 0-9
- `C-a “`: List all windows
- `C-a A`: Rename current window
Session Management:
- - `C-a d`: Detach from current session
- - `C-a x`: Lock the screen session
Split Screen:
- `C-a S`: Split display horizontally
- `C-a |`: Split display vertically
- `C-a tab`: Switch between regions
Copy Mode:
- `C-a [`: Enter copy mode
- `C-a ]`: Paste from copy buffer
Other Useful Commands:
- `C-a ?`: Show help
- `C-a a`: Send `Ctrl+a` to the current window
- `C-a k`: Kill current window
- `C-a \`: Kill all windows and terminate screen
Remember that you can customize these bindings in your `~.screenrc` file to suit your preferences.
References:
software/cli/screen.txt · Last modified: 2024/11/01 14:33 by warnaud