- Share a screen session: \\ in one terminal screen -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
==== Upgrading system ====
Network might goes down while full system upgrade
ssh -t machine.to.update screen -d -R -S Upgrade
If it goes down, same command reconnects to the screen session "Upgrade"
====== 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:
* https://www.rackaid.com/blog/linux-screen-tutorial-and-how-to/
* https://www.howtoforge.com/sharing-terminal-sessions-with-tmux-and-screen
* http://www.computerhope.com/unix/screen.htm
* https://aperiodic.net/screen/interface
* https://stackoverflow.com/questions/8353470/gnu-screen-custom-key-bindings-format
* https://wiki.archlinux.org/title/GNU_Screen
* https://www.gnu.org/software/screen/manual/html_node/Default-Key-Bindings.html
* https://www.gnu.org/software/screen/manual/html_node/Key-Binding.html
* https://opensource.com/article/17/3/introduction-gnu-screen
* https://web.mit.edu/gnu/doc/html/screen_13.html
* https://tonisagrista.com/blog/2021/gnu-screen-cheatsheet/