<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: kj_sh604</title>
    <description>The latest articles on DEV Community by kj_sh604 (@kj_sh604).</description>
    <link>https://dev.to/kj_sh604</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1793891%2F25ad8bf3-920a-4e78-bdfe-38dc27fc28a8.jpg</url>
      <title>DEV Community: kj_sh604</title>
      <link>https://dev.to/kj_sh604</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kj_sh604"/>
    <language>en</language>
    <item>
      <title>My Simple GNU Screen Set-up 🧑‍💻 (TMUX Alternative)</title>
      <dc:creator>kj_sh604</dc:creator>
      <pubDate>Wed, 17 Jul 2024 16:36:46 +0000</pubDate>
      <link>https://dev.to/kj_sh604/my-simple-gnu-screen-set-up-tmux-alternative-41j0</link>
      <guid>https://dev.to/kj_sh604/my-simple-gnu-screen-set-up-tmux-alternative-41j0</guid>
      <description>&lt;p&gt;&lt;em&gt;This article was originally posted on my &lt;a href="https://aedrielkylejavier.me/blog/2024-07-15_gnu-screen/" rel="noopener noreferrer"&gt;ad-free blog&lt;/a&gt;. For more content, including extra downloadables and resources for this post — feel free to visit my &lt;a href="https://aedrielkylejavier.me/" rel="noopener noreferrer"&gt;website&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;Now, before anything, I personally wouldn't recommend &lt;strong&gt;switching&lt;/strong&gt; to GNU &lt;code&gt;screen&lt;/code&gt; &lt;strong&gt;if&lt;/strong&gt; you already have a &lt;code&gt;tmux&lt;/code&gt; configuration. I believe &lt;code&gt;tmux&lt;/code&gt; excels in terms of extensibility, documentation, and community support, with numerous videos and guides available. This blog post is best suited for those who might &lt;strong&gt;not&lt;/strong&gt; have a terminal multiplexer setup yet and are looking for something simple, built-in, and somewhat &lt;a href="https://suckless.org/philosophy/" rel="noopener noreferrer"&gt;"suckless"&lt;/a&gt; 🧩.&lt;/p&gt;

&lt;p&gt;GNU &lt;code&gt;screen&lt;/code&gt; provides all the necessities of a terminal multiplexer with a few essential features and configurability options sprinkled on top ✨. If you don't foresee the need to heavily &lt;em&gt;extend&lt;/em&gt; the tool, want to keep your setup straightforward, and aren't interested in creating elaborate configurations for &lt;a href="https://www.reddit.com/r/unixporn/" rel="noopener noreferrer"&gt;show&lt;/a&gt;, GNU &lt;code&gt;screen&lt;/code&gt; might be perfect for those long SSH sessions and productive late nights with text editors like Neovim and other CLI tools.&lt;/p&gt;

&lt;p&gt;In this post, I'll share my simple GNU Screen setup, which I find more than sufficient for my needs. I hope this post serves as a good starting point for anyone looking to configure a terminal multiplexer 👍.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Set-up
&lt;/h2&gt;

&lt;p&gt;I have two concurrent GNU &lt;code&gt;screen&lt;/code&gt; setups on my machines. One for when I am in a session where the &lt;code&gt;X11&lt;/code&gt; display server is running (essentially, when using a graphical environment):&lt;/p&gt;

&lt;p&gt;&lt;a href="https://aedrielkylejavier.me/articles/img/gnu-screen-images/0.png" rel="noopener noreferrer"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxhtehiqrsg31effhd1im.png" alt="Image of my GNU screen setup" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And another for when I am in a TTY session (a text-based environment without a graphical interface):&lt;/p&gt;

&lt;p&gt;&lt;a href="https://aedrielkylejavier.me/articles/img/gnu-screen-images/1.png" rel="noopener noreferrer"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fivjtjvms5rz3u9nmy1re.png" alt="Image of my GNU screen setup in a TTY" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  The "Top Bar"
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;hardstatus&lt;/code&gt; line consists of a few basic elements:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://aedrielkylejavier.me/articles/img/gnu-screen-images/3.png" rel="noopener noreferrer"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl0y7do1qxmo9mnellu10.png" alt="Image of my GNU screen hardstatus line in a TTY" width="800" height="49"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://aedrielkylejavier.me/articles/img/gnu-screen-images/2.png" rel="noopener noreferrer"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fav6dj59cz6um3s9smv07.png" alt="Image of my GNU screen hardstatus line in a GUI / X11 Window Manager/ Desktop Environment" width="800" height="48"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A&lt;/strong&gt; &lt;em&gt;(Top-left)&lt;/em&gt; — a simple hard-coded &lt;code&gt;[ GNU screen ]&lt;/code&gt; indicator to signify that you are in an attached session.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;B&lt;/strong&gt; &lt;em&gt;(Middle-left)&lt;/em&gt; — a horizontal "window buttons list" similar to a taskbar in a panel.

&lt;ul&gt;
&lt;li&gt;The "Active Window" is represented within " &lt;code&gt;(==&lt;/code&gt; " and " &lt;code&gt;==)&lt;/code&gt; ".&lt;/li&gt;
&lt;li&gt;The X11 &lt;code&gt;screen&lt;/code&gt; config has more &lt;em&gt;verbose&lt;/em&gt; "window" titles.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;C&lt;/strong&gt; &lt;em&gt;(Top-right)&lt;/em&gt; — a "textclock" displaying the date, day, and time (only present in the &lt;code&gt;tty&lt;/code&gt; config).&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;This setup is meant to be "functionally simple" and not reliant on any &lt;a href="https://www.nerdfonts.com/" rel="noopener noreferrer"&gt;Nerd Fonts&lt;/a&gt; or other non-ASCII characters, so you can get up and running with a multiplexer even on a barebones Linux install.&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  Keybindings
&lt;/h2&gt;

&lt;p&gt;My preferred "prefix" key is &lt;code&gt;Ctrl&lt;/code&gt;+&lt;code&gt;space&lt;/code&gt; (instead of the default, &lt;code&gt;Ctrl&lt;/code&gt;+&lt;code&gt;a&lt;/code&gt;). This prefix key seems to conflict less with known default terminal programs’ keybindings unless it was explicitly set in said tools (e.g., in a VI/Vim/Neovim config). Here are some of my configuration's keybindings based on the common commands presented in the &lt;a href="https://wiki.archlinux.org/title/GNU_Screen#Common_Commands" rel="noopener noreferrer"&gt;ArchWiki&lt;/a&gt;.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Keybind&lt;/th&gt;
&lt;th&gt;Action&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Ctrl+space     "&lt;/td&gt;
&lt;td&gt;toggle window list&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ctrl+space     1&lt;/td&gt;
&lt;td&gt;open window 1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ctrl+space     0&lt;/td&gt;
&lt;td&gt;open window 10&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ctrl+space     ?&lt;/td&gt;
&lt;td&gt;display commands and their defaults&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ctrl+space     A&lt;/td&gt;
&lt;td&gt;rename the current window&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ctrl+space     Esc&lt;/td&gt;
&lt;td&gt;enter copy mode (use enter to select a range of text)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ctrl+space     Q&lt;/td&gt;
&lt;td&gt;close all regions but the current one&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ctrl+space     S&lt;/td&gt;
&lt;td&gt;split the current region horizontally into two regions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ctrl+space     ]&lt;/td&gt;
&lt;td&gt;paste text&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ctrl+space     a&lt;/td&gt;
&lt;td&gt;send ctrl+a to the current window&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ctrl+space     c&lt;/td&gt;
&lt;td&gt;create a new window (with shell)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ctrl+space     d&lt;/td&gt;
&lt;td&gt;detach from the current screen session and leave it running. use &lt;code&gt;screen -r&lt;/code&gt; to resume&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ctrl+space     k&lt;/td&gt;
&lt;td&gt;"kill" the current window&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ctrl+space     tab&lt;/td&gt;
&lt;td&gt;switch the input focus to the next region&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ctrl+space     \&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ctrl+space     :&lt;/td&gt;
&lt;td&gt;enter the command prompt of screen&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ctrl+space     :quit&lt;/td&gt;
&lt;td&gt;close all windows and close the screen session&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ctrl+space     :source&lt;/td&gt;
&lt;td&gt;reload the screenrc configuration file (can alternatively use /etc/screenrc)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  Replicate My GNU Screen Config 🚀
&lt;/h2&gt;

&lt;p&gt;Due to my VI/Neovim configuration requiring True Color (24-bit) support, I use GNU Screen 5.0.0 (the -git master branch), which finally has the &lt;code&gt;truecolor&lt;/code&gt; setting. For those who prefer not to compile software and would rather stick with the versions available in the repositories, I also have a similar configuration that works with &lt;code&gt;screen&lt;/code&gt; versions &lt;code&gt;&amp;lt;= 4.9.1&lt;/code&gt; (which only support 256 colors). I will share both configurations in this blog post.&lt;/p&gt;

&lt;h2&gt;
  
  
  GNU Screen 5.0.0 (-git master branch)
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://aedrielkylejavier.me/articles/img/gnu-screen-images/0.png" rel="noopener noreferrer"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxhtehiqrsg31effhd1im.png" alt="Image of my GNU screen setup" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Installation Instructions for GNU Screen &lt;code&gt;-git&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The following are installation instructions for Linux distributions that have a &lt;code&gt;-git&lt;/code&gt; GNU &lt;code&gt;screen&lt;/code&gt; package.&lt;/p&gt;

&lt;h4&gt;
  
  
  Arch Linux (AUR)
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;paru &lt;span class="nt"&gt;-S&lt;/span&gt; screen-git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;yay &lt;span class="nt"&gt;-S&lt;/span&gt; screen-git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Download screen-git PKGBUILD&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;wget &lt;span class="s1"&gt;'https://aur.archlinux.org/cgit/aur.git/snapshot/screen-git.tar.gz'&lt;/span&gt;
&lt;span class="c"&gt;# Extract Tarball&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;tar&lt;/span&gt; &lt;span class="nt"&gt;-xvf&lt;/span&gt; screen-git.tar.gz
&lt;span class="c"&gt;# Change Directory to screen-git/&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;screen-git/
&lt;span class="c"&gt;# Build Package&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;makepkg &lt;span class="nt"&gt;-si&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt; &lt;/p&gt;

&lt;h3&gt;
  
  
  Building From Source
&lt;/h3&gt;

&lt;p&gt;The following are build instructions for the &lt;code&gt;-git&lt;/code&gt; version of GNU &lt;code&gt;screen&lt;/code&gt;.&lt;/p&gt;

&lt;h5&gt;
  
  
  Install Dependencies for Your Distro
&lt;/h5&gt;

&lt;p&gt;&lt;em&gt;Ubuntu/Debian&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; git autoconf automake libtool make gcc libncurses5-dev libpam0g-dev libssl-dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Fedora&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;dnf &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; git autoconf automake libtool make gcc ncurses-devel pam-devel openssl-devel
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Gentoo&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;emerge dev-vcs/git autoconf automake libtool gcc sys-libs/ncurses sys-libs/pam dev-libs/openssl
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Alpine Linux&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apk add git autoconf automake libtool make gcc ncurses-dev pam-dev openssl-dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;OpenSUSE&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;zypper &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; git autoconf automake libtool make gcc ncurses-devel pam-devel libopenssl-devel
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt; &lt;/p&gt;

&lt;h5&gt;
  
  
  Clone, Build, and Run GNU &lt;code&gt;screen&lt;/code&gt;
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Clone Source&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;git clone https://git.savannah.gnu.org/git/screen.git
&lt;span class="c"&gt;# Switch to screen/src directory&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;screen/src
&lt;span class="c"&gt;# Build GNU Screen&lt;/span&gt;
&lt;span class="nv"&gt;$ NOCONFIGURE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1 ./autogen.sh
&lt;span class="nv"&gt;$ &lt;/span&gt;sh ./configure &lt;span class="se"&gt;\&lt;/span&gt;
            &lt;span class="nt"&gt;--prefix&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/usr/local &lt;span class="se"&gt;\&lt;/span&gt;
            &lt;span class="nt"&gt;--mandir&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/usr/share/man &lt;span class="se"&gt;\&lt;/span&gt;
            &lt;span class="nt"&gt;--infodir&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/usr/share/info &lt;span class="se"&gt;\&lt;/span&gt;
            &lt;span class="nt"&gt;--enable-colors256&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
            &lt;span class="nt"&gt;--enable-pam&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
            &lt;span class="nt"&gt;--enable-telnet&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
            &lt;span class="nt"&gt;--enable-utmp&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
            &lt;span class="nt"&gt;--with-pty-group&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$_ptygroup&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;make
&lt;span class="c"&gt;# Optional&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;make &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="c"&gt;# or place binary in a PATH= directory&lt;/span&gt;
&lt;span class="c"&gt;# Run and Test GNU screen&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;./screen
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt; &lt;/p&gt;

&lt;h3&gt;
  
  
  Configuration (GNU Screen 5.0.0 &lt;code&gt;-git&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;~/.screenrc&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# this config requires Screen v5 (-git master branch release)&lt;/span&gt;
truecolor on
hardstatus off &lt;span class="c"&gt;# puts notifications at the bottom&lt;/span&gt;
hardstatus alwaysfirstline &lt;span class="s1"&gt;'%{#999999}[ GNU screen ]%{#ffffff} %&amp;lt; %{7}%?%-Lw%?%{1;0}%{#009dff}(== %{#ffffff}%n %h%?(%u)%?%{1;0}%{#009dff} ==)%{7}%?%+Lw%?%?'&lt;/span&gt;
altscreen on
&lt;span class="nb"&gt;bind &lt;/span&gt;0 &lt;span class="k"&gt;select &lt;/span&gt;10
&lt;span class="nb"&gt;bind &lt;/span&gt;c screen 1
defscrollback 5000
escape ^@a
maptimeout 0
screen 1
startup_message off
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or&lt;/p&gt;

&lt;p&gt;&lt;code&gt;~/.screenrc&lt;/code&gt; &lt;em&gt;(with clock, as found in my TTY config)&lt;/em&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# this config requires Screen v5 (-git master branch release)&lt;/span&gt;
truecolor on
backtick 0 5 5 &lt;span class="s2"&gt;"/usr/bin/date"&lt;/span&gt; &lt;span class="s1"&gt;'+%m/%d (%a)'&lt;/span&gt;
backtick 1 5 5 &lt;span class="s2"&gt;"/usr/bin/date"&lt;/span&gt; &lt;span class="s1"&gt;'+%H%M'&lt;/span&gt;
hardstatus off &lt;span class="c"&gt;# puts notifications at the bottom&lt;/span&gt;
hardstatus alwaysfirstline &lt;span class="s1"&gt;'%{#999999}[ GNU screen ]%{#ffffff} %&amp;lt; %{7}%?%-Lw%?%{1;0}%{#009dff}(== %{#ffffff}%n%f%t%?(%u)%?%{1;0}%{#009dff} ==)%{7}%?%+Lw%?%? %= %{#999999}[ %{#999999}%0` %1` ]'&lt;/span&gt;
altscreen on
&lt;span class="nb"&gt;bind &lt;/span&gt;0 &lt;span class="k"&gt;select &lt;/span&gt;10
&lt;span class="nb"&gt;bind &lt;/span&gt;c screen 1
defscrollback 5000
escape ^@a
maptimeout 0
screen 1
startup_message off
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  GNU Screen 4.0.0+ (Stable Release Across Distros)
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://aedrielkylejavier.me/articles/img/gnu-screen-images/4.png" rel="noopener noreferrer"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffwmergj07w5j3dq5u38j.png" alt="Image of my GNU screen 4.0 partial setup" width="800" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Installation Instructions for GNU Screen 4.0.0+
&lt;/h3&gt;

&lt;p&gt;GNU Screen version 4.0.0+ is widely available across various Linux distributions through their respective package managers. Below are the installation commands for some common distributions.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Debian/Ubuntu&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;screen
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Fedora&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;dnf &lt;span class="nb"&gt;install &lt;/span&gt;screen
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Arch Linux&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;pacman &lt;span class="nt"&gt;-S&lt;/span&gt; screen
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Gentoo&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;emerge &lt;span class="nt"&gt;--ask&lt;/span&gt; app-misc/screen
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Alpine Linux&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apk add screen
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;openSUSE&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;zypper &lt;span class="nb"&gt;install &lt;/span&gt;screen
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt; &lt;/p&gt;

&lt;p&gt;After installation, you can run GNU Screen by simply typing &lt;code&gt;screen&lt;/code&gt; in your terminal.&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;h3&gt;
  
  
  Configuration (GNU Screen 4.0.0+)
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;.screenrc&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;attrcolor b &lt;span class="s2"&gt;".I"&lt;/span&gt;
termcapinfo xterm &lt;span class="s1"&gt;'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'&lt;/span&gt;
defbce on
backtick 0 5 5 &lt;span class="s2"&gt;"/usr/bin/date"&lt;/span&gt; &lt;span class="s1"&gt;'+%m/%d (%a)'&lt;/span&gt;
backtick 1 5 5 &lt;span class="s2"&gt;"/usr/bin/date"&lt;/span&gt; &lt;span class="s1"&gt;'+%H%M'&lt;/span&gt;
hardstatus alwaysfirstline
hardstatus string &lt;span class="s1"&gt;'%{= kW}[%{W} GNU screen %{W}]%{W} %&amp;lt; %{kW}%?%-Lw%?%{= kB}(== %{W}%n*%f %t%?(%u)%? %{kB}==)%{= kW}%?%+Lw%?%? %= %{kW}[%{W}%0` %{W}%1`%{kW}]'&lt;/span&gt;
altscreen on
&lt;span class="nb"&gt;bind &lt;/span&gt;0 &lt;span class="k"&gt;select &lt;/span&gt;10
&lt;span class="nb"&gt;bind &lt;/span&gt;c screen 1
defscrollback 5000
escape ^@a
maptimeout 0
screen 1
startup_message off
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;vim tip for versions &amp;lt; 5.0.0:&lt;/em&gt;&lt;/strong&gt; &lt;em&gt;make sure &lt;code&gt;termguicolors&lt;/code&gt; is set to &lt;code&gt;false&lt;/code&gt; in your &lt;code&gt;.vimrc&lt;/code&gt;, or omitted entirely&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Dynamic &lt;code&gt;screen&lt;/code&gt; Configuration Based on Session
&lt;/h2&gt;

&lt;p&gt;On my machines, these configs are dynamically loaded based on session. I also follow the &lt;a href="https://specifications.freedesktop.org/basedir-spec/latest" rel="noopener noreferrer"&gt;XDG Base Directory Specification&lt;/a&gt; by declaring the &lt;code&gt;SCREENRC=&lt;/code&gt; environment variable, which moves the configuration from &lt;code&gt;~/.screenrc&lt;/code&gt; to whatever path is specified in the variable.&lt;/p&gt;

&lt;p&gt;If you would also like to load individual configs based on whether you're in an X11 or a TTY session, refer to this snippet of my &lt;code&gt;.config/shell/profile&lt;/code&gt; :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/sh&lt;/span&gt;
…
&lt;span class="c"&gt;# X11-dependent env variables&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$DISPLAY&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; xhost &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
    &lt;/span&gt;setxkbmap &lt;span class="nt"&gt;-option&lt;/span&gt; compose:ralt
    xset r rate 300 50
    &lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;SCREENRC&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$XDG_CONFIG_HOME&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;/screen/screenrc
    &lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;XPROFILE_X11_SPECIFICS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;loaded
&lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="c"&gt;# if TTY&lt;/span&gt;
    &lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;SCREENRC&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$XDG_CONFIG_HOME&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;/screen/screenrc-if-tty
    &lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;XPROFILE_X11_SPECIFICS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;unloaded
    &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"X11 is not running... X11-related settings have been skipped"&lt;/span&gt;
&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This file is sourced by my &lt;code&gt;fish&lt;/code&gt; shell config (via a method similar to what is mentioned in the &lt;a href="https://wiki.archlinux.org/title/Fish#Source_/etc/profile_on_login" rel="noopener noreferrer"&gt;ArchWiki&lt;/a&gt;). The file is also symlinked to &lt;code&gt;.zprofile&lt;/code&gt;, &lt;code&gt;.profile&lt;/code&gt;, and &lt;code&gt;.xprofile&lt;/code&gt;/&lt;code&gt;.xsessionrc&lt;/code&gt; in case I want to go back to using &lt;code&gt;zsh&lt;/code&gt; or &lt;code&gt;bash&lt;/code&gt; as my default shell again.&lt;/p&gt;

&lt;h2&gt;
  
  
  Changing the "Prefix" Key
&lt;/h2&gt;

&lt;p&gt;If you would like to have a different "prefix" key, you can run &lt;code&gt;showkey -a&lt;/code&gt; to examine the codes sent by the keyboard and then grab the ASCII output, append an "a", and modify the config like so:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://aedrielkylejavier.me/articles/img/gnu-screen-images/new-keybind.png" rel="noopener noreferrer"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsi5vdctir7aaiknm25zx.png" alt="Image of screenkey and showkey when pressing Ctrl+\ " width="800" height="741"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Output while pressing&lt;/em&gt; &lt;code&gt;Ctrl&lt;/code&gt;+&lt;code&gt;\&lt;/code&gt;&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;To apply, replace the &lt;code&gt;escape ^@a&lt;/code&gt; line in the config with:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;escape ^&lt;span class="se"&gt;\a&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt; &lt;/p&gt;

&lt;p&gt;For more information on this, you can refer to the ArchWiki's "Change The Escape Key" &lt;a href="https://wiki.archlinux.org/title/GNU_Screen#Change_the_escape_key" rel="noopener noreferrer"&gt;GNU Screen Article&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping Up 🎁
&lt;/h2&gt;

&lt;p&gt;That's it for my simple GNU Screen setup! While GNU Screen might not be as feature-rich as &lt;code&gt;tmux&lt;/code&gt;, I believe it offers a straightforward and functional alternative for those who prefer simplicity and minimalism with their tools. The configurations shared here should provide a solid foundation to get you started. Feel free to experiment with the configs and make them your own.&lt;/p&gt;

&lt;p&gt;Happy hacking, and may your terminal sessions be ever efficient and productive! 🚀&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

</description>
      <category>linux</category>
      <category>vim</category>
      <category>programming</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
