User Tools

Site Tools


software:cli:screen

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
software:cli:screen [2021/12/29 21:09] – ↷ Page moved from cli:screen to software:cli:screen warnaudsoftware:cli:screen [2025/07/07 07:11] (current) warnaud
Line 1: Line 1:
 +  - Share a screen session: \\ in one terminal <code bash> screen -S SharedSession </code> in another terminal <code bash> screen -x SharedSession </code> :!: 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: <code>Ctrl + a + h </code>
 +  - Detach a screen inside a screen:<code>Ctrl + a + a + d</code>
 +  - Serial console: <code bash> screen /dev/ttyS0 19200</code>
  
 +==== Upgrading system ====
 +Network might goes down while full system upgrade
 +<code bash>ssh -t machine.to.update screen -d -R -S Upgrade</code>
 +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: ====
 +
 +<code>screen</code>
 +
 +
 +==== Start a named screen session: ====
 +
 +
 +<code>screen -S session_name</code>
 +
 +
 +==== Reconnect to a detached session: ====
 +
 +
 +<code>screen -r</code>
 +
 +
 +==== List running sessions: ====
 +
 +
 +<code>screen -ls</code>
 +
 +
 +==== Reconnect to a specific session: ====
 +
 +
 +<code>screen -r session_name</code>
 +
 +
 +===== 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/