<?xml version="1.0" encoding="utf-8" standalone="yes"?><feed xmlns="http://www.w3.org/2005/Atom">
  <title></title>
  <subtitle></subtitle>
  <id>https://www.endpointdev.com/blog/tags/terminal/</id>
  <link href="https://www.endpointdev.com/blog/tags/terminal/"/>
  <link href="https://www.endpointdev.com/blog/tags/terminal/" rel="self"/>
  <updated>2022-01-05T00:00:00+00:00</updated>
  <author>
    <name>End Point Dev</name>
  </author>
  
    <entry>
      <title>Word diff: Git as wdiff alternative</title>
      <link rel="alternate" href="https://www.endpointdev.com/blog/2022/01/wdiff-alternative-git-diff-word-diff/"/>
      <id>https://www.endpointdev.com/blog/2022/01/wdiff-alternative-git-diff-word-diff/</id>
      <published>2022-01-05T00:00:00+00:00</published>
      <author>
        <name>Jon Jensen</name>
      </author>
      <content type="html">
        &lt;p&gt;&lt;img src=&#34;/blog/2022/01/wdiff-alternative-git-diff-word-diff/20210823_183559-sm.jpg&#34; alt=&#34;5 drinking fountains mounted on a wall at varying levels&#34;&gt;&lt;/p&gt;
&lt;!-- Image by Jon Jensen --&gt;
&lt;p&gt;The &lt;code&gt;diff&lt;/code&gt; utility to show differences between two files was created in 1974 as part of Unix. It has been incredibly useful and popular ever since, and hasn&amp;rsquo;t changed much since 1991 when it gained the ability to output the now standard &amp;ldquo;unified context diff&amp;rdquo; format.&lt;/p&gt;
&lt;p&gt;The comparison &lt;code&gt;diff&lt;/code&gt; makes is per line, so if anything on a given line changes, in unified context format we can tell that the previous version of that line was removed by seeing &lt;code&gt;-&lt;/code&gt; at the beginning of the old line, and the following line will start with &lt;code&gt;+&lt;/code&gt; followed by the new version.&lt;/p&gt;
&lt;p&gt;For example see this Dockerfile that had two lines changed:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-diff&#34; data-lang=&#34;diff&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ diff -u Dockerfile.old Dockerfile
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#fdd&#34;&gt;--- Dockerfile.old	2022-01-05 22:16:21 -0700
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#fdd&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#000;background-color:#dfd&#34;&gt;+++ Dockerfile	2022-01-05 23:08:55 -0700
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#dfd&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;@@ -2,7 +2,7 @@
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#666&#34;&gt;&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; WORKDIR /usr/src/app
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#fdd&#34;&gt;-# Bundle app source
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#fdd&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#000;background-color:#dfd&#34;&gt;+# Bundle entire source
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#dfd&#34;&gt;&lt;/span&gt; COPY . .
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#fdd&#34;&gt;-RUN /usr/src/app/test.sh
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#fdd&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#000;background-color:#dfd&#34;&gt;+RUN /usr/src/app/start.sh
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;That works well for visually reviewing changes to many types of files that developers typically work with.&lt;/p&gt;
&lt;p&gt;It can also serve as input to the &lt;code&gt;patch&lt;/code&gt; program, which dates to 1985 and is still in wide use as a counterpart to &lt;code&gt;diff&lt;/code&gt;. With &lt;code&gt;patch&lt;/code&gt; we can apply changes to a file and avoid the need to send an entire new file or apply changes by hand (which is very prone to error).&lt;/p&gt;
&lt;p&gt;But let&amp;rsquo;s leave that aside and focus on humans reading &lt;code&gt;diff&lt;/code&gt; output.&lt;/p&gt;
&lt;h3 id=&#34;diffing-paragraphs&#34;&gt;Diffing paragraphs&lt;/h3&gt;
&lt;p&gt;For a file containing paragraphs of prose each on their own long lines, it can look like the lines change completely when we change only a few words. This is often the case with HTML destined to be displayed in a web browser, email text, or the Markdown source for this blog post itself.&lt;/p&gt;
&lt;p&gt;Consider this file with one long line of sample text gathered from pangrams and typing exercises:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-plain&#34; data-lang=&#34;plain&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ cat -n paragraph.txt 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;     1	The quick brown fox jumped over the lazy dog&amp;#39;s back 1234567890 times. Now is the time for all good men to come to the aid of the party. Waltz, bad nymph, for quick jigs vex. Glib jocks quiz nymph to vex dwarf. Sphinx of black quartz, judge my vow. How vexingly quick daft zebras jump! The five boxing wizards jump quickly. Jackdaws love my big sphinx of quartz. Pack my box with five dozen liquor jugs.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;If we change even one character of that, &lt;code&gt;diff&lt;/code&gt; will show that its one line changed, but we have to painstakingly visually scan the entire long line to determine what exactly changed and where. That is not very useful.&lt;/p&gt;
&lt;p&gt;We can wrap, or split up, the lines into multiple lines of a maximum of 75 characters with the classic Unix tool &lt;code&gt;fmt&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-plain&#34; data-lang=&#34;plain&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ fmt paragraph.txt | tee wrapped.txt
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;The quick brown fox jumped over the lazy dog&amp;#39;s back 1234567890
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;times. Now is the time for all good men to come to the aid of the
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;party. Waltz, bad nymph, for quick jigs vex. Glib jocks quiz nymph
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;to vex dwarf. Sphinx of black quartz, judge my vow. How vexingly
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;quick daft zebras jump! The five boxing wizards jump quickly.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Jackdaws love my big sphinx of quartz. Pack my box with five dozen
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;liquor jugs.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;With those shorter lines, changes will be easier to see than with one long line, but it is still hard to pick out small changes:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-diff&#34; data-lang=&#34;diff&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ diff -u wrapped.txt wrapped2.txt         
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#fdd&#34;&gt;--- wrapped.txt	2022-01-05 23:22:46 -0700
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#fdd&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#000;background-color:#dfd&#34;&gt;+++ wrapped2.txt	2022-01-05 23:38:14 -0700
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#dfd&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;@@ -1,7 +1,7 @@
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#666&#34;&gt;&lt;/span&gt; The quick brown fox jumped over the lazy dog&amp;#39;s back 1234567890
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#fdd&#34;&gt;-times. Now is the time for all good men to come to the aid of the
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#fdd&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#000;background-color:#dfd&#34;&gt;+times. Now is thy time for all good men to come to the aid of the
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#dfd&#34;&gt;&lt;/span&gt; party. Waltz, bad nymph, for quick jigs vex. Glib jocks quiz nymph
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; to vex dwarf. Sphinx of black quartz, judge my vow. How vexingly
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#fdd&#34;&gt;-quick daft zebras jump! The five boxing wizards jump quickly.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#fdd&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#000;background-color:#dfd&#34;&gt;+quick daft zebras jump! Tho five boxing wizards jump quickly.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#dfd&#34;&gt;&lt;/span&gt; Jackdaws love my big sphinx of quartz. Pack my box with five dozen
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; liquor jugs.
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;And much worse, every line changes when we make a significant edit early in the text and reflow the paragraph to fit our maximum line length. Here is what happens after adding &amp;ldquo;an amazing count of&amp;rdquo; in the first line and re-wrapping the lines:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-diff&#34; data-lang=&#34;diff&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#333&#34;&gt;diff -u wrapped.txt wrapped3.txt
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#333&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#000;background-color:#fdd&#34;&gt;--- wrapped.txt	2022-01-05 23:22:46 -0700
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#fdd&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#000;background-color:#dfd&#34;&gt;+++ wrapped3.txt	2022-01-06 08:05:33 -0700
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#dfd&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;@@ -1,7 +1,7 @@
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#666&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#000;background-color:#fdd&#34;&gt;-The quick brown fox jumped over the lazy dog&amp;#39;s back 1234567890
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#fdd&#34;&gt;-times. Now is the time for all good men to come to the aid of the
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#fdd&#34;&gt;-party. Waltz, bad nymph, for quick jigs vex. Glib jocks quiz nymph
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#fdd&#34;&gt;-to vex dwarf. Sphinx of black quartz, judge my vow. How vexingly
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#fdd&#34;&gt;-quick daft zebras jump! The five boxing wizards jump quickly.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#fdd&#34;&gt;-Jackdaws love my big sphinx of quartz. Pack my box with five dozen
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#fdd&#34;&gt;-liquor jugs.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#fdd&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#000;background-color:#dfd&#34;&gt;+The quick brown fox jumped over the lazy dog&amp;#39;s back an amazing count
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#dfd&#34;&gt;+of 1234567890 times. Now is thy time for all good men to come to
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#dfd&#34;&gt;+the aid of the party. Waltz, bad nymph, for quick jigs vex. Glib
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#dfd&#34;&gt;+jocks quiz nymph to vex dwarf. Sphinx of black quartz, judge my
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#dfd&#34;&gt;+vow. How vexingly quick daft zebras jump! Tho five boxing wizards
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#dfd&#34;&gt;+jump quickly.  Jackdaws love my big sphinx of quartz. Pack my box
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#dfd&#34;&gt;+with five dozen liquor jugs.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;That gives no aid to a human proofreader!&lt;/p&gt;
&lt;h3 id=&#34;word-diff-to-the-rescue&#34;&gt;Word diff to the rescue&lt;/h3&gt;
&lt;p&gt;In 1992 François Pinard wrote the word-based diff program &lt;code&gt;wdiff&lt;/code&gt; which is now part of the GNU project. It solves this problem.&lt;/p&gt;
&lt;p&gt;Here is how it shows us our example changing two words:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-plain&#34; data-lang=&#34;plain&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ wdiff wrapped.txt wrapped2.txt   
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;The quick brown fox jumped over the lazy dog&amp;#39;s back 1234567890
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;times. Now is [-the-] {+thy+} time for all good men to come to the aid of the
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;party. Waltz, bad nymph, for quick jigs vex. Glib jocks quiz nymph
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;to vex dwarf. Sphinx of black quartz, judge my vow. How vexingly
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;quick daft zebras jump! [-The-] {+Tho+} five boxing wizards jump quickly.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Jackdaws love my big sphinx of quartz. Pack my box with five dozen
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;liquor jugs.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Words removed are by default marked with &lt;code&gt;[-…-]&lt;/code&gt; and words added with &lt;code&gt;{+…+}&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;It even knows how to accommodate word changes appearing on different lines! Trying it out on our example with the reflowed paragraph:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-plain&#34; data-lang=&#34;plain&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ wdiff wrapped.txt wrapped3.txt
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;The quick brown fox jumped over the lazy dog&amp;#39;s back {+an amazing count
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;of+} 1234567890 times. Now is [-the-] {+thy+} time for all good men to come to
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;the aid of the party. Waltz, bad nymph, for quick jigs vex. Glib
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;jocks quiz nymph to vex dwarf. Sphinx of black quartz, judge my
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;vow. How vexingly quick daft zebras jump! [-The-] {+Tho+} five boxing wizards
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;jump quickly.  Jackdaws love my big sphinx of quartz. Pack my box
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;with five dozen liquor jugs.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;So this is very nice, although &lt;code&gt;wdiff&lt;/code&gt; often isn&amp;rsquo;t available by default on the various systems we find ourselves on, and it is perhaps a bit worrisome that the &lt;code&gt;wdiff&lt;/code&gt; software has not been updated since 2014.&lt;/p&gt;
&lt;p&gt;Too bad this word-diffing feature is not part of standard &lt;code&gt;diff&lt;/code&gt;!&lt;/p&gt;
&lt;h3 id=&#34;a-familiar-friend&#34;&gt;A familiar friend&lt;/h3&gt;
&lt;p&gt;That&amp;rsquo;s ok because you probably already have a &lt;code&gt;wdiff&lt;/code&gt; alternative available on your computer: Git! More specifically, &lt;code&gt;git diff --word-diff&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Maybe you already use that feature when working with your local clones of Git repositories, to look at what changed in the commit history or local edits. Did you know that &lt;code&gt;git diff&lt;/code&gt; can act as a complete replacement of the standalone &lt;code&gt;diff&lt;/code&gt; tool? Yes, &lt;code&gt;git diff&lt;/code&gt; can also compare two arbitrary files that are not part of a Git repository when given the &lt;code&gt;--no-index&lt;/code&gt; option!&lt;/p&gt;
&lt;p&gt;And Git can usually tell you mean &lt;code&gt;--no-index&lt;/code&gt; without you typing that explicitly because you&amp;rsquo;re comparing at least one file that is not tracked in a Git clone, so you can just type:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-plain&#34; data-lang=&#34;plain&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ git diff --word-diff &amp;lt;path1&amp;gt; &amp;lt;path2&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;for any two file paths and it will work.&lt;/p&gt;
&lt;p&gt;Trying this out with our sample paragraph:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff&#34;&gt;&lt;code class=&#34;language-diff&#34; data-lang=&#34;diff&#34;&gt;$ git diff --word-diff wrapped.txt wrapped2.txt
&lt;span style=&#34;font-weight: bold&#34;&gt;diff --git a/wrapped.txt b/wrapped2.txt
index b1c5775..59ff315 100644
--- a/wrapped.txt
+++ b/wrapped2.txt&lt;/span&gt;
&lt;span style=&#34;color:blue&#34;&gt;@@ -1,7 +1,7 @@&lt;/span&gt;
The quick brown fox jumped over the lazy dog&#39;s back 1234567890
times. Now is &lt;span style=&#34;color:#000;background-color:tomato&#34;&gt;[-the-]&lt;/span&gt;&lt;span style=&#34;color:#000;background-color:lightgreen&#34;&gt;{+thy+}&lt;/span&gt; time for all good men to come to the aid of the
party. Waltz, bad nymph, for quick jigs vex. Glib jocks quiz nymph
to vex dwarf. Sphinx of black quartz, judge my vow. How vexingly
quick daft zebras jump! &lt;span style=&#34;color:#000;background-color:tomato&#34;&gt;[-The-]&lt;/span&gt;&lt;span style=&#34;color:#000;background-color:lightgreen&#34;&gt;{+Tho+}&lt;/span&gt; five boxing wizards jump quickly.
Jackdaws love my big sphinx of quartz. Pack my box with five dozen
liquor jugs.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;It uses the same word deletion and insertion markers as &lt;code&gt;wdiff&lt;/code&gt;, but to make them easier for our eyes to spot, by default &lt;code&gt;git diff&lt;/code&gt; also shows them in different colors when output is going to an interactive terminal. You can disable the coloring with the additional option &lt;code&gt;--color=never&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Use &lt;code&gt;git diff --word-diff=color&lt;/code&gt; for a pretty view using &lt;em&gt;only&lt;/em&gt; color to show the changes, without the &lt;code&gt;[-…-]&lt;/code&gt; and &lt;code&gt;{+…+}&lt;/code&gt; markers. This may be more readable when your input text is full of punctuation confusingly similar to the markers, and is useful if you want to copy from the terminal without any extra surrounding characters:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff&#34;&gt;&lt;code class=&#34;language-diff&#34; data-lang=&#34;diff&#34;&gt;$ git diff --word-diff=color wrapped.txt wrapped2.txt
&lt;span style=&#34;font-weight: bold&#34;&gt;diff --git a/wrapped.txt b/wrapped2.txt
index b1c5775..59ff315 100644
--- a/wrapped.txt
+++ b/wrapped2.txt&lt;/span&gt;
&lt;span style=&#34;color:blue&#34;&gt;@@ -1,7 +1,7 @@&lt;/span&gt;
The quick brown fox jumped over the lazy dog&#39;s back 1234567890
times. Now is &lt;span style=&#34;color:#000;background-color:tomato&#34;&gt;the&lt;/span&gt;&lt;span style=&#34;color:#000;background-color:lightgreen&#34;&gt;thy&lt;/span&gt; time for all good men to come to the aid of the
party. Waltz, bad nymph, for quick jigs vex. Glib jocks quiz nymph
to vex dwarf. Sphinx of black quartz, judge my vow. How vexingly
quick daft zebras jump! &lt;span style=&#34;color:#000;background-color:tomato&#34;&gt;The&lt;/span&gt;&lt;span style=&#34;color:#000;background-color:lightgreen&#34;&gt;Tho&lt;/span&gt; five boxing wizards jump quickly.
Jackdaws love my big sphinx of quartz. Pack my box with five dozen
liquor jugs.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;There is also the option &lt;code&gt;git diff --word-diff=porcelain&lt;/code&gt; for an ugly but more easily code-parseable format useful for output sent as input to scripts:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-plain&#34; data-lang=&#34;plain&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ git diff --word-diff=porcelain wrapped.txt wrapped2.txt
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;diff --git a/wrapped.txt b/wrapped2.txt
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;index b1c5775..59ff315 100644
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;--- a/wrapped.txt
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;+++ b/wrapped2.txt
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;@@ -1,7 +1,7 @@
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; The quick brown fox jumped over the lazy dog&amp;#39;s back 1234567890
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;~
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; times. Now is 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;-the
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;+thy
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  time for all good men to come to the aid of the
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;~
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; party. Waltz, bad nymph, for quick jigs vex. Glib jocks quiz nymph
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;~
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; to vex dwarf. Sphinx of black quartz, judge my vow. How vexingly
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;~
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; quick daft zebras jump! 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;-The
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;+Tho
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  five boxing wizards jump quickly.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;~
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; Jackdaws love my big sphinx of quartz. Pack my box with five dozen
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;~
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; liquor jugs.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;~&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;I have never needed that yet, but it is good to be aware of in case I ever do need to parse word diff output, to make it easier and more reliable.&lt;/p&gt;
&lt;h3 id=&#34;customize-word-break-definition&#34;&gt;Customize word break definition&lt;/h3&gt;
&lt;p&gt;Other kinds of files can present challenges for readability in diff output.&lt;/p&gt;
&lt;p&gt;For example consider trying to see small changes in the classic Unix &lt;code&gt;/etc/passwd&lt;/code&gt; text &amp;ldquo;database&amp;rdquo; which has one user record per line, and within each record line uses &lt;code&gt;:&lt;/code&gt; to delimit fields.&lt;/p&gt;
&lt;p&gt;First we&amp;rsquo;ll try traditional line diff:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-diff&#34; data-lang=&#34;diff&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ git diff passwd passwd.mangled
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#333&#34;&gt;diff --git a/passwd b/passwd.mangled
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#333&#34;&gt;index 981736c..6531f10 100644
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#333&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#000;background-color:#fdd&#34;&gt;--- a/passwd
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#fdd&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#000;background-color:#dfd&#34;&gt;+++ b/passwd.mangled
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#dfd&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;@@ -24,22 +24,22 @@ polkitd:x:996:991:User for polkitd:/:/sbin/nologin
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#666&#34;&gt;&lt;/span&gt; rtkit:x:172:172:RealtimeKit:/proc:/sbin/nologin
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; pulse:x:171:171:PulseAudio System Daemon:/var/run/pulse:/sbin/nologin
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; chrony:x:995:988::/var/lib/chrony:/sbin/nologin
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#fdd&#34;&gt;-abrt:x:173:173::/etc/abrt:/sbin/nologin
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#fdd&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#000;background-color:#dfd&#34;&gt;+abrt:x:173:1730::/etc/abrt:/sbin/nologin
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#dfd&#34;&gt;&lt;/span&gt; colord:x:994:987:User for colord:/var/lib/colord:/sbin/nologin
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; vboxadd:x:993:1::/var/run/vboxadd:/sbin/nologin
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; dnsmasq:x:985:985:Dnsmasq DHCP and DNS server:/var/lib/dnsmasq:/sbin/nologin
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#fdd&#34;&gt;-tcpdump:x:72:72::/:/sbin/nologin
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#fdd&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#000;background-color:#dfd&#34;&gt;+tcpdump:x:72:72::/:/bin/bash
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#dfd&#34;&gt;&lt;/span&gt; systemd-timesync:x:984:984:systemd Time Synchronization:/:/sbin/nologin
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; pipewire:x:983:983:PipeWire System Daemon:/var/run/pipewire:/sbin/nologin
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; gluster:x:982:982:GlusterFS daemons:/run/gluster:/sbin/nologin
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#fdd&#34;&gt;-radvd:x:75:75:radvd user:/:/sbin/nologin
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#fdd&#34;&gt;-saslauth:x:981:76:Saslauthd user:/run/saslauthd:/sbin/nologin
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#fdd&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#000;background-color:#dfd&#34;&gt;+radvd:x:76:75:radvd user:/:/sbin/nologin
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#dfd&#34;&gt;+saslauth:x:981:76:Saslauthd user:/ran/saslauthd:/sbin/nologin
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#dfd&#34;&gt;&lt;/span&gt; usbmuxd:x:113:113:usbmuxd user:/:/sbin/nologin
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; setroubleshoot:x:980:979::/var/lib/setroubleshoot:/sbin/nologin
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; openvpn:x:979:978:OpenVPN:/etc/openvpn:/sbin/nologin
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#fdd&#34;&gt;-nm-openvpn:x:978:977:Default user for running openvpn spawned by NetworkManager:/:/sbin/nologin
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#fdd&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#000;background-color:#dfd&#34;&gt;+mm-openvpn:x:978:977:Default user for running openvpn spawned by NetworkManager:/:/sbin/nologin
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;background-color:#dfd&#34;&gt;&lt;/span&gt; qemu:x:107:107:qemu user:/:/sbin/nologin
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; gdm:x:42:42::/var/lib/gdm:/sbin/nologin
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; apache:x:48:48:Apache:/usr/share/httpd:/sbin/nologin
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;It&amp;rsquo;s not too hard to &amp;ldquo;eyeball&amp;rdquo; changes there if they add or remove characters and thus affect the line lengths. But a line with only a change to a single character isn&amp;rsquo;t as easy.&lt;/p&gt;
&lt;p&gt;Since blank space is not the relevant separator in this file, standard word diff doesn&amp;rsquo;t help and in some cases is worse than line diff:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff&#34;&gt;&lt;code class=&#34;language-diff&#34; data-lang=&#34;diff&#34;&gt;$ git diff --word-diff passwd passwd.mangled
&lt;span style=&#34;font-weight: bold&#34;&gt;diff --git a/passwd b/passwd.mangled
index 981736c..6531f10 100644
--- a/passwd
+++ b/passwd.mangled&lt;/span&gt;
&lt;span style=&#34;color:blue&#34;&gt;@@ -24,22 +24,22 @@&lt;/span&gt; polkitd:x:996:991:User for polkitd:/:/sbin/nologin
rtkit:x:172:172:RealtimeKit:/proc:/sbin/nologin
pulse:x:171:171:PulseAudio System Daemon:/var/run/pulse:/sbin/nologin
chrony:x:995:988::/var/lib/chrony:/sbin/nologin
&lt;span style=&#34;color:#000;background-color:tomato&#34;&gt;[-abrt:x:173:173::/etc/abrt:/sbin/nologin-]&lt;/span&gt;&lt;span style=&#34;color:#000;background-color:lightgreen&#34;&gt;{+abrt:x:173:1730::/etc/abrt:/sbin/nologin+}&lt;/span&gt;
colord:x:994:987:User for colord:/var/lib/colord:/sbin/nologin
rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
vboxadd:x:993:1::/var/run/vboxadd:/sbin/nologin
dnsmasq:x:985:985:Dnsmasq DHCP and DNS server:/var/lib/dnsmasq:/sbin/nologin
&lt;span style=&#34;color:#000;background-color:tomato&#34;&gt;[-tcpdump:x:72:72::/:/sbin/nologin-]&lt;/span&gt;&lt;span style=&#34;color:#000;background-color:lightgreen&#34;&gt;{+tcpdump:x:72:72::/:/bin/bash+}&lt;/span&gt;
systemd-timesync:x:984:984:systemd Time Synchronization:/:/sbin/nologin
pipewire:x:983:983:PipeWire System Daemon:/var/run/pipewire:/sbin/nologin
gluster:x:982:982:GlusterFS daemons:/run/gluster:/sbin/nologin
&lt;span style=&#34;color:#000;background-color:tomato&#34;&gt;[-radvd:x:75:75:radvd-]&lt;/span&gt;&lt;span style=&#34;color:#000;background-color:lightgreen&#34;&gt;{+radvd:x:76:75:radvd+}&lt;/span&gt; user:/:/sbin/nologin
saslauth:x:981:76:Saslauthd &lt;span style=&#34;color:#000;background-color:tomato&#34;&gt;[-user:/run/saslauthd:/sbin/nologin-]&lt;/span&gt;&lt;span style=&#34;color:#000;background-color:lightgreen&#34;&gt;{+user:/ran/saslauthd:/sbin/nologin+}&lt;/span&gt;
usbmuxd:x:113:113:usbmuxd user:/:/sbin/nologin
setroubleshoot:x:980:979::/var/lib/setroubleshoot:/sbin/nologin
openvpn:x:979:978:OpenVPN:/etc/openvpn:/sbin/nologin
&lt;span style=&#34;color:#000;background-color:tomato&#34;&gt;[-nm-openvpn:x:978:977:Default-]&lt;/span&gt;&lt;span style=&#34;color:#000;background-color:lightgreen&#34;&gt;{+mm-openvpn:x:978:977:Default+}&lt;/span&gt; user for running openvpn spawned by NetworkManager:/:/sbin/nologin
qemu:x:107:107:qemu user:/:/sbin/nologin
gdm:x:42:42::/var/lib/gdm:/sbin/nologin
apache:x:48:48:Apache:/usr/share/httpd:/sbin/nologin
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Another venerable program similar to &lt;code&gt;wdiff&lt;/code&gt; that is still maintained is &lt;code&gt;dwdiff&lt;/code&gt;. In its self-description we read something intriguing:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;It is different from wdiff in that it allows the user to specify what should be considered whitespace …&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;That sounds useful. But &lt;code&gt;dwdiff&lt;/code&gt; is still a separate program and is even less common than &lt;code&gt;wdiff&lt;/code&gt;. Can the versatile &lt;code&gt;git diff&lt;/code&gt; help us here too?&lt;/p&gt;
&lt;p&gt;Yes! &lt;code&gt;git diff&lt;/code&gt; has the option &lt;code&gt;--word-diff-regex&lt;/code&gt; to specify a regular expression to use instead of whitespace as a delimiter, like &lt;code&gt;dwdiff&lt;/code&gt; does. The man page explanation notes:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;For example, &lt;code&gt;--word-diff-regex=.&lt;/code&gt; will treat each character as a word and, correspondingly, show differences character by character.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;It also notes that &lt;code&gt;--word-diff&lt;/code&gt; is assumed and can be omitted when using &lt;code&gt;--word-diff-regex&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;So let&amp;rsquo;s try that:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff&#34;&gt;&lt;code class=&#34;language-diff&#34; data-lang=&#34;diff&#34;&gt;$ git diff --word-diff-regex=. passwd passwd.mangled
&lt;span style=&#34;font-weight: bold&#34;&gt;diff --git a/passwd b/passwd.mangled
index 981736c..6531f10 100644
--- a/passwd
+++ b/passwd.mangled&lt;/span&gt;
&lt;span style=&#34;color:blue&#34;&gt;@@ -24,22 +24,22 @@&lt;/span&gt; polkitd:x:996:991:User for polkitd:/:/sbin/nologin
rtkit:x:172:172:RealtimeKit:/proc:/sbin/nologin
pulse:x:171:171:PulseAudio System Daemon:/var/run/pulse:/sbin/nologin
chrony:x:995:988::/var/lib/chrony:/sbin/nologin
abrt:x:173:173&lt;span style=&#34;color:#000;background-color:lightgreen&#34;&gt;{+0+}&lt;/span&gt;::/etc/abrt:/sbin/nologin
colord:x:994:987:User for colord:/var/lib/colord:/sbin/nologin
rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
vboxadd:x:993:1::/var/run/vboxadd:/sbin/nologin
dnsmasq:x:985:985:Dnsmasq DHCP and DNS server:/var/lib/dnsmasq:/sbin/nologin
tcpdump:x:72:72::/:/&lt;span style=&#34;color:#000;background-color:tomato&#34;&gt;[-s-]&lt;/span&gt;bin/&lt;span style=&#34;color:#000;background-color:tomato&#34;&gt;[-nologin-]&lt;/span&gt;&lt;span style=&#34;color:#000;background-color:lightgreen&#34;&gt;{+bash+}&lt;/span&gt;
systemd-timesync:x:984:984:systemd Time Synchronization:/:/sbin/nologin
pipewire:x:983:983:PipeWire System Daemon:/var/run/pipewire:/sbin/nologin
gluster:x:982:982:GlusterFS daemons:/run/gluster:/sbin/nologin
radvd:x:7&lt;span style=&#34;color:#000;background-color:tomato&#34;&gt;[-5-]&lt;/span&gt;&lt;span style=&#34;color:#000;background-color:lightgreen&#34;&gt;{+6+}&lt;/span&gt;:75:radvd user:/:/sbin/nologin
saslauth:x:981:76:Saslauthd user:/r&lt;span style=&#34;color:#000;background-color:tomato&#34;&gt;[-u-]&lt;/span&gt;&lt;span style=&#34;color:#000;background-color:lightgreen&#34;&gt;{+a+}&lt;/span&gt;n/saslauthd:/sbin/nologin
usbmuxd:x:113:113:usbmuxd user:/:/sbin/nologin
setroubleshoot:x:980:979::/var/lib/setroubleshoot:/sbin/nologin
openvpn:x:979:978:OpenVPN:/etc/openvpn:/sbin/nologin
&lt;span style=&#34;color:#000;background-color:tomato&#34;&gt;[-n-]&lt;/span&gt;&lt;span style=&#34;color:#000;background-color:lightgreen&#34;&gt;{+m+}&lt;/span&gt;m-openvpn:x:978:977:Default user for running openvpn spawned by NetworkManager:/:/sbin/nologin
qemu:x:107:107:qemu user:/:/sbin/nologin
gdm:x:42:42::/var/lib/gdm:/sbin/nologin
apache:x:48:48:Apache:/usr/share/httpd:/sbin/nologin
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;That&amp;rsquo;s quite good, at least to my eyes.&lt;/p&gt;
&lt;h3 id=&#34;on-the-web&#34;&gt;On the web&lt;/h3&gt;
&lt;p&gt;GitHub, GitLab, and Bitbucket do a good job of showing readable diffs for most common cases: line-oriented, but within each line also word or character diffs highlighted via color. Open up each of the following links to see how they present a few of our earlier examples as commit diffs:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Change 2 letters in prose paragraph: &lt;a href=&#34;https://github.com/jonjensen/word-diff-examples/commit/07ab55f0acb6410e30688515a7a0bc95ed6a37b1&#34;&gt;🔗 in GitHub&lt;/a&gt;, &lt;a href=&#34;https://gitlab.com/jonjensen/word-diff-examples/-/commit/07ab55f0acb6410e30688515a7a0bc95ed6a37b1&#34;&gt;🔗 in GitLab&lt;/a&gt;, &lt;a href=&#34;https://bitbucket.org/jonjensen/word-diff-examples/commits/07ab55f0acb6410e30688515a7a0bc95ed6a37b1&#34;&gt;🔗 in Bitbucket&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Change a few characters in &lt;code&gt;/etc/passwd&lt;/code&gt;: &lt;a href=&#34;https://github.com/jonjensen/word-diff-examples/commit/faa5f309a6d83a898a2b84fdf4c1c16189bb0be8&#34;&gt;🔗 in GitHub&lt;/a&gt;, &lt;a href=&#34;https://gitlab.com/jonjensen/word-diff-examples/-/commit/faa5f309a6d83a898a2b84fdf4c1c16189bb0be8&#34;&gt;🔗 in GitLab&lt;/a&gt;, &lt;a href=&#34;https://bitbucket.org/jonjensen/word-diff-examples/commits/faa5f309a6d83a898a2b84fdf4c1c16189bb0be8&#34;&gt;🔗 in Bitbucket&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;But GitHub and GitLab both break down on a reflowed paragraph, while Bitbucket shows a sensible diff of what logically changed, including spaces to newlines and vice versa:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Insert words early in paragraph and reflow: &lt;a href=&#34;https://github.com/jonjensen/word-diff-examples/commit/986ab1450f434d675b69c60b67a837f4bf11c84f&#34;&gt;🔗 in GitHub&lt;/a&gt;, &lt;a href=&#34;https://gitlab.com/jonjensen/word-diff-examples/-/commit/986ab1450f434d675b69c60b67a837f4bf11c84f&#34;&gt;🔗 in GitLab&lt;/a&gt;, &lt;a href=&#34;https://bitbucket.org/jonjensen/word-diff-examples/commits/986ab1450f434d675b69c60b67a837f4bf11c84f&#34;&gt;🔗 in Bitbucket&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It appears that GitLab may soon gain proper cross-line word diff ability as seen in the project&amp;rsquo;s issue &lt;a href=&#34;https://gitlab.com/gitlab-org/gitlab/-/issues/325856&#34;&gt;Add word-diff option to commits view&lt;/a&gt;, which states its &amp;ldquo;Problem to solve&amp;rdquo; as:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;When working with markdown (or any type of prose/text in general), the &amp;ldquo;classic&amp;rdquo; git-diff (intended for code) is of limited use.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Exactly right.&lt;/p&gt;
&lt;h3 id=&#34;ides&#34;&gt;IDEs&lt;/h3&gt;
&lt;p&gt;Visual Studio Code (VS Code) handles the above cases well out of the box for uncommitted changes in the current Git clone, and the GitLens extension helps it do the same for showing past commit diffs.&lt;/p&gt;
&lt;p&gt;IntelliJ IDEA handles both cases well by default.&lt;/p&gt;
&lt;h3 id=&#34;for-those-left-behind&#34;&gt;For those left behind&lt;/h3&gt;
&lt;p&gt;To make the most of Git, you&amp;rsquo;ll want a fairly recent version, since new features are being added all the time. If you&amp;rsquo;re working on a server using the popular but aging CentOS 7 which comes with the ancient Git 1.8.3, you can follow our &lt;a href=&#34;/blog/2021/12/installing-git-2-on-centos-7/&#34;&gt;simple tutorial to upgrade to Git 2.34.1 or newer on CentOS 7&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Enjoy!&lt;/p&gt;
&lt;h3 id=&#34;reference&#34;&gt;Reference&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://en.wikipedia.org/wiki/Diff&#34;&gt;diff&lt;/a&gt; on Wikipedia, including history and samples of original, context, and unified context diff output&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://en.wikipedia.org/wiki/Patch_(Unix)&#34;&gt;patch&lt;/a&gt; on Wikipedia&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://git-scm.com/docs/git-diff&#34;&gt;git-diff&lt;/a&gt; man page&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.gnu.org/software/wdiff/&#34;&gt;wdiff&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://os.ghalkes.nl/dwdiff.html&#34;&gt;dwdiff&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://en.wikipedia.org/wiki/Pangram&#34;&gt;Pangrams&lt;/a&gt; on Wikipedia, the source of our sample prose here&lt;/li&gt;
&lt;/ul&gt;

      </content>
    </entry>
  
    <entry>
      <title>GNU Screen logtstamp string</title>
      <link rel="alternate" href="https://www.endpointdev.com/blog/2013/07/gnu-screen-logtstamp-string/"/>
      <id>https://www.endpointdev.com/blog/2013/07/gnu-screen-logtstamp-string/</id>
      <published>2013-07-24T00:00:00+00:00</published>
      <author>
        <name>Jon Jensen</name>
      </author>
      <content type="html">
        &lt;p&gt;A short note on &lt;a href=&#34;https://www.gnu.org/software/screen/&#34;&gt;GNU Screen&lt;/a&gt; configuration:&lt;/p&gt;
&lt;p&gt;You can add configuration to &lt;code&gt;~/.screenrc&lt;/code&gt; or another configuration file named by &lt;code&gt;-c $filename&lt;/code&gt; upon invocation, and among the many options are some to enable logging what happens in the screen windows. This is useful when using screen as a reattachable daemonizer.&lt;/p&gt;
&lt;p&gt;Consider this configuration:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-plain&#34; data-lang=&#34;plain&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;logfile path/to/screen-output.%Y%m%d.log
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;logfile flush 1
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;logtstamp on
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;logtstamp after 5
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;log on&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;That works nicely. With &lt;code&gt;logfile&lt;/code&gt; we specify the name of the log file, using some &lt;code&gt;%&lt;/code&gt; escapes as per “STRING ESCAPES” in the manpage to put the date in the logfile name.&lt;/p&gt;
&lt;p&gt;With &lt;code&gt;logfile flush 1&lt;/code&gt; we request that every 1 second the output be flushed to the log, making it easier to follow with &lt;code&gt;tail -f&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;logtstamp on&lt;/code&gt; option writes a timestamp to the log after a default 2 minutes of inactivity. We shorten that to 5 seconds with &lt;code&gt;logtstamp after 5&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Finally, &lt;code&gt;log on&lt;/code&gt; turns on the logging.&lt;/p&gt;
&lt;p&gt;Now, what if we want to customize the timestamp? The default looks like this:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-plain&#34; data-lang=&#34;plain&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;-- 0:process-name -- time-stamp -- Jul/24/13  9:09:56 --&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The manpage says that can be customized with &lt;code&gt;logtstampt string ...&lt;/code&gt;, where the default is:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-plain&#34; data-lang=&#34;plain&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;-- %n:%t -- time-stamp -- %M/%d/%y %c:%s --\n&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The manpage earlier says that arguments may be separated by single or double quotes. Doing so with the default shown doesn’t work, because a literal \n shows up in the logfile.&lt;/p&gt;
&lt;p&gt;The solution I worked out by trial and error is that you must double-quote the string and use octal escape value &lt;code&gt;\012&lt;/code&gt;. Single-quoting that will output a literal backslash 0 1 2, and &lt;code&gt;\n&lt;/code&gt; simply is not a recognized escape. Thus our final configuration directive is:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-plain&#34; data-lang=&#34;plain&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;logtstamp string &amp;#34;-- time-stamp -- %Y-%m-%d %0c:%s --\012&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;which results in output like:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-plain&#34; data-lang=&#34;plain&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;-- time-stamp -- 2013-07-24 09:59:35 --&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;If you use more than one screen window with this configuration, all windows’ output will go into the same logfile. Use the &lt;code&gt;%n&lt;/code&gt; escape string to include a window number in the logfile name if you’d like them kept separate.&lt;/p&gt;

      </content>
    </entry>
  
    <entry>
      <title>tmux and SecureCRT settings</title>
      <link rel="alternate" href="https://www.endpointdev.com/blog/2012/12/tmux-and-securecrt-settings/"/>
      <id>https://www.endpointdev.com/blog/2012/12/tmux-and-securecrt-settings/</id>
      <published>2012-12-14T00:00:00+00:00</published>
      <author>
        <name>Ron Phipps</name>
      </author>
      <content type="html">
        &lt;p&gt;Richard gave me a call today to show the wonders of tmux. I am using Windows, and unfortunately, right off the bat I couldn’t see color and there were a bunch of accented &lt;code&gt;a&lt;/code&gt;s dividing the panes.&lt;/p&gt;
&lt;p&gt;After some trial and error and finding &lt;a href=&#34;https://stackoverflow.com/questions/8483798/tmux-borders-displayed-as-x-q-instead-of-lines&#34;&gt;this post&lt;/a&gt; on the subject we got it working. The key is to configure SecureCRT to use xterm + ANSI colors and set the character set to UTF-8 and “Use Unicode line drawing code points”.&lt;/p&gt;
&lt;p&gt;Hooray! I’ll be trying out tmux in day-to-day use to see if it will replace or augment screen for me.&lt;/p&gt;

      </content>
    </entry>
  
    <entry>
      <title>Update Your GNU Screen Config on the Fly</title>
      <link rel="alternate" href="https://www.endpointdev.com/blog/2012/12/update-your-gnu-screen-config-on-fly/"/>
      <id>https://www.endpointdev.com/blog/2012/12/update-your-gnu-screen-config-on-fly/</id>
      <published>2012-12-14T00:00:00+00:00</published>
      <author>
        <name>Greg Davidson</name>
      </author>
      <content type="html">
        &lt;h3 id=&#34;an-indispensable-tool&#34;&gt;An Indispensable Tool&lt;/h3&gt;
&lt;p&gt;I use &lt;a href=&#34;https://www.gnu.org/software/screen/&#34;&gt;Screen&lt;/a&gt; constantly in my work at End Point. It is an indispensable tool that I would not want to operate without. It’s so handy to resume where I left off after I’ve detached or when my connection drops unexpectedly. This is likely preaching to the choir but if you are not already using Screen and/or &lt;a href=&#34;https://tmux.sourceforge.io/&#34;&gt;tmux&lt;/a&gt;, start now.&lt;/p&gt;
&lt;h3 id=&#34;the-scenario&#34;&gt;The Scenario&lt;/h3&gt;
&lt;p&gt;I often find myself in the following situation:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;SSH into a server&lt;/li&gt;
&lt;li&gt;Fire up a new Screen session&lt;/li&gt;
&lt;li&gt;Create several windows for editing files, tailing logs, etc.&lt;/li&gt;
&lt;li&gt;Realize the default Screen configuration is inadequate or does not exist.&lt;/li&gt;
&lt;li&gt;Facepalm \O/&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;While my needs are fairly minimal, I do like to bump up the scrollback buffer and display the list of windows in the status line.&lt;/p&gt;
&lt;img alt=&#34;Screen example&#34; border=&#34;0&#34; height=&#34;470&#34; src=&#34;/blog/2012/12/update-your-gnu-screen-config-on-fly/image-0.png&#34; title=&#34;screen-example.png&#34; width=&#34;563&#34;/&gt; 
&lt;p&gt;There are a couple of options at this point. I could put up with the default / non-existent configuration or create a config file and manually re-create the session and all of the windows to pick up the configuration changes. Neither of these options was desirable.&lt;/p&gt;
&lt;p&gt;I wanted to be able to update the configuration and have &lt;strong&gt;all&lt;/strong&gt; of the &lt;strong&gt;existing windows&lt;/strong&gt; pick up the changes. After asking around a little I ended up taking a look at &lt;a href=&#34;https://www.gnu.org/software/screen/manual/&#34;&gt;the manual&lt;/a&gt; and discovered the &lt;code&gt;source&lt;/code&gt; command.&lt;/p&gt;
&lt;h3 id=&#34;use-the-source-command&#34;&gt;Use the source (command)&lt;/h3&gt;
&lt;p&gt;The source command can be used to load or reload a Screen configuration file. It can be invoked from inside a Screen session like so:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-plain&#34; data-lang=&#34;plain&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;C-a :source /absolute/path/to/config_file&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;It is important to note that you must use the absolute path to the config file. There are exceptions which can be found in the Screen man pages but I found it easier to just use the absolute path.&lt;/p&gt;
&lt;p&gt;Once the source command has been issued, the configuration will be applied to &lt;strong&gt;all&lt;/strong&gt; existing windows! This was exactly what I was looking for. Armed with this information I copied my local &lt;code&gt;.screenrc&lt;/code&gt; to the system clipboard, created a new config file on server and applied it to my session using the &lt;code&gt;source&lt;/code&gt; command.&lt;/p&gt;
&lt;h3 id=&#34;works-with-tmux-too&#34;&gt;Works with tmux too&lt;/h3&gt;
&lt;p&gt;I like to use tmux as well and was happy to &lt;a href=&#34;https://man.openbsd.org/tmux.1&#34;&gt;find in its manpage&lt;/a&gt; that it has a similar feature. The source-file command (&lt;code&gt;source&lt;/code&gt; is aliased as well) is invoked in the exactly the same way:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-plain&#34; data-lang=&#34;plain&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;C-prefix :source /absolute/path/to/config_file&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;After issuing the source-file command, all of the windows and panes in the current session will pick up the configuration changes.&lt;/p&gt;
&lt;h3 id=&#34;changing-the-default-directory&#34;&gt;Changing the Default Directory&lt;/h3&gt;
&lt;p&gt;Another related issue I often run into is wishing I had started my Screen or tmux session in a different directory. By default, when you start a Screen or tmux session, all new windows (and panes) will be opened from the same directory where Screen or tmux was invoked. However, this directory can be changed for existing sessions.&lt;/p&gt;
&lt;p&gt;For Screen, the chdir command can be used:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-plain&#34; data-lang=&#34;plain&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;C-a :chdir /some/new/directory&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;In tmux, the default-path command can be used:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-plain&#34; data-lang=&#34;plain&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;C-prefix :default-path /some/new/directory&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;After issuing the chdir or default-path commands, all new windows and panes will be opened from the specified directory.&lt;/p&gt;
&lt;p&gt;I hope this has been helpful — feel free add your own Screen and tmux tips in the comments!&lt;/p&gt;

      </content>
    </entry>
  
</feed>
