<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Russell Parker</title>
    <link>https://russellparker.me/</link>
    <description>Recent content on Russell Parker</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <managingEditor>russell.parker7@gmail.com (Russell Parker)</managingEditor>
    <webMaster>russell.parker7@gmail.com (Russell Parker)</webMaster>
    <copyright>This work is licensed under a Creative Commons Attribution 4.0 International License</copyright>
    <lastBuildDate>Tue, 10 Apr 2018</lastBuildDate>
    
        <atom:link href="https://russellparker.me/index.xml" rel="self" type="application/rss+xml" />
    
    
    <item>
      <title>How Learning GPG Is Like Learning Git</title>
      <link>https://russellparker.me/post/2018/04/10/how-learning-gpg-is-like-learning-git/</link>
      <pubDate>Tue, 10 Apr 2018</pubDate>
      <author>russell.parker7@gmail.com (Russell Parker)</author>
      <guid>https://russellparker.me/post/2018/04/10/how-learning-gpg-is-like-learning-git/</guid>
      <description>

&lt;h3 id=&#34;experience-of-learning-gpg&#34;&gt;Experience of Learning GPG&lt;/h3&gt;

&lt;p&gt;I&amp;rsquo;ve been trying to teach myself more about cryptography and GPG in particular.
The resources I&amp;rsquo;ve encountered so far mainly fall into two categories:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Step-by-step setup and configuration guides&lt;/li&gt;
&lt;li&gt;Tutorials on how to accomplish a specific task&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Some include a primer on public-key cryptogaphy but they otherwise lack
details that would help build a mental model of GPG. One notable exception was
&lt;a href=&#34;https://davesteele.github.io/gpg/2014/09/20/anatomy-of-a-gpg-key/&#34;&gt;Anatomy of a GPG Key&lt;/a&gt;
which also echoes similar observations about the style of other guides.&lt;/p&gt;

&lt;p&gt;GPG is often criticized for its poor usability and perhaps it&amp;rsquo;s this poor
usability that drives people to make instructional resources rather than
conceptual ones. I think a better approach to teaching the tool is emphasizing
the underlying structure of keys and how various steps affect this structure.
Running a series of commands to perform key maintenance would be more intuitive
with an understanding of what&amp;rsquo;s going on at the key packet-level.&lt;/p&gt;

&lt;p&gt;This perspective on studying GPG has parallels in how some people learn Git.&lt;/p&gt;

&lt;h3 id=&#34;learning-git&#34;&gt;Learning Git&lt;/h3&gt;

&lt;p&gt;There are tons of Git tutorials covering things like cloning repos,
staging changes, and pushing commits. There is nothing wrong with starting here
but just memorizing these routines can eventually obscure the simplicity of the
underlying system.&lt;/p&gt;

&lt;p&gt;Mastering Git means touching on blobs and Merkle trees and SHA-1
hashes. Knowing these details provides a more manageable mental map which
is important because a big part of learning is creating a mental scaffolding and
incorporating auxiliary info and data points.&lt;/p&gt;

&lt;p&gt;&lt;a href=&#34;https://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Porcelain&#34;&gt;Chapter 10 of Pro Git&lt;/a&gt; opens with the tradeoff
between introducing porcelain commands and covering the core design of Git.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&amp;hellip;this is where we’ll go over the inner workings and implementation of
Git. We found that understanding this information was fundamentally important
to appreciating how useful and powerful Git is, but others have argued to us
that it can be confusing and unnecessarily complex for beginners.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;While it may be &amp;ldquo;confusing and unnecessarily complex&amp;rdquo; to begin here, I&amp;rsquo;d argue
that covering these inner workings eventually leads to a more intuitive grasp of
how to accomplish tasks with Git rather than just regurgitating a series of
commands.&lt;/p&gt;

&lt;h3 id=&#34;conclusion&#34;&gt;Conclusion&lt;/h3&gt;

&lt;p&gt;In &lt;em&gt;The Mythical Man-Month: Essays on Software Engineering&lt;/em&gt;, Fred Brooks wrote,&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Show me your flowcharts and conceal your tables, and I shall continue to be
mystified. Show me your tables, and I won’t usually need your flowcharts;
they’ll be obvious.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This line of thinking applies to learning tools as well. Ultimately, a crucial
part of understanding systems like Git and GPG is understanding their data
strctures. We&amp;rsquo;re always going to need reference material but focusing too much
on just procedural steps will prevent a simpler comprehension.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>More man Improvements</title>
      <link>https://russellparker.me/post/2018/03/12/more-man-improvements/</link>
      <pubDate>Mon, 12 Mar 2018</pubDate>
      <author>russell.parker7@gmail.com (Russell Parker)</author>
      <guid>https://russellparker.me/post/2018/03/12/more-man-improvements/</guid>
      <description>

&lt;p&gt;In &lt;a href=&#34;https://russellparker.me/post/2018/02/23/adding-colors-to-man/&#34;&gt;a previous post&lt;/a&gt; I explored using
colors with &lt;code&gt;man&lt;/code&gt;. Here are a few more adjustments to make browsing manpages
nicer.&lt;/p&gt;

&lt;h3 id=&#34;section-navigation&#34;&gt;Section Navigation&lt;/h3&gt;

&lt;p&gt;We can make navigating the sections of a particular page a little bit easier.
By default, there is no simple way to do this. Going off of
&lt;a href=&#34;https://bbs.archlinux.org/viewtopic.php?id=99899&#34;&gt;this forum&lt;/a&gt;, we can add some
searchable text to denote a section heading:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;.\&amp;quot; man.local

.\&amp;quot; Add a searchable string before each section header
.rn SH SH-orig
.de SH
.SH-orig \(sc \\$*
..
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This file, &lt;a href=&#34;https://linux.die.net/man/7/groff_man&#34;&gt;&lt;code&gt;man.local&lt;/code&gt;&lt;/a&gt;, defines a
groff macro that uses the escape code &lt;code&gt;\(sc&lt;/code&gt; to prepend
&lt;a href=&#34;http://man.gnu.org.ua/manpage/?7+groff_char&#34;&gt;the glyph&lt;/a&gt; § to section headings.
The result looks like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;§ NAME
       man - an interface to the on-line reference manuals
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This makes it simpler to navigate a man page because we can search for the
glyph and go to the next and previous section with &lt;code&gt;n&lt;/code&gt; and &lt;code&gt;N&lt;/code&gt;, respectively.
&lt;code&gt;less&lt;/code&gt; keeps a history so repeating a previous search is easy, but we can also
create a key-binding that automates this.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# ~/.lesskey

#command
    # remap tab to search for section
    \t forw-search §\r

&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Note: &lt;code&gt;#command&lt;/code&gt; is not a comment but a required directive.&lt;/p&gt;

&lt;p&gt;This can be compiled for &lt;code&gt;less&lt;/code&gt; with the
&lt;a href=&#34;https://linux.die.net/man/1/lesskey&#34;&gt;&lt;code&gt;lesskey&lt;/code&gt;&lt;/a&gt; command which will bind
&lt;kbd&gt;Tab&lt;/kbd&gt; to searching for the above glyph.&lt;/p&gt;

&lt;h3 id=&#34;prompt&#34;&gt;Prompt&lt;/h3&gt;

&lt;p&gt;The prompt is a ribbon of text displayed at the bottom of a &lt;code&gt;less&lt;/code&gt; screen.
&lt;code&gt;man&lt;/code&gt; has a default prompt which attempts to show the total number of lines
and the current position as a percent. Since the formatted manpage is piped
into &lt;code&gt;less&lt;/code&gt; though the program does not know about the total length. If you
reach the bottom of a file though (try the &lt;kbd&gt;G&lt;/kbd&gt; command), this
additional information will be displayed. A hack to jump to the end of a file
and back again is:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# ~/.bashrc

export MANPAGER=&#39;less +Gg&#39;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This tells &lt;code&gt;less&lt;/code&gt; to run the commands &lt;kbd&gt;G&lt;/kbd&gt; and &lt;kbd&gt;g&lt;/kbd&gt; when opening
a file which scans to the end of the input and then back to the beginning. By
doing this, &lt;code&gt;less&lt;/code&gt; figures out the total length of the file and can print the
total line numbers and current percent in the ribbon. The tradeoff is that this
can cause a noticeable performance hit when opening large man pages like &lt;code&gt;bash&lt;/code&gt;.
This can also be accomplished by setting the LESS environment variable but
doing so can interfere with other programs that use &lt;code&gt;less&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The prompt itself can be simplified somewhat as well to get rid of the
overbearing &amp;ldquo;(press h for help or q to quit)&amp;rdquo; message.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# ~/.bashrc

export MANLESS=&#39;\ Manual\ page\ \$MAN_PN\ %lt/%L %pB\%&#39;
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&#34;line-length&#34;&gt;Line Length&lt;/h3&gt;

&lt;p&gt;I find reading manpages in wide terminals more difficult (although it may make
skimming easier). Setting a maximum
&lt;a href=&#34;https://practicaltypography.com/line-length.html&#34;&gt;line width&lt;/a&gt; for man.
&lt;code&gt;MANWIDTH&lt;/code&gt; does exactly this but will hard-code the value instead of acting as
a maximum. A solution is to put some logic in a &lt;code&gt;BASH_PROMPT&lt;/code&gt; function.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# ~/.bashrc

export PROMPT_COMMAND=prompt
prompt() {
    # set line width for man pages with maximum of 80
    if [ $COLUMNS -lt 80 ]; then
        export MANWIDTH=$COLUMNS
    else
        export MANWIDTH=80
    fi
}
&lt;/code&gt;&lt;/pre&gt;
</description>
    </item>
    
    <item>
      <title>Samsung Chromebook 3 as a Developer Laptop</title>
      <link>https://russellparker.me/post/2018/03/07/samsung-chromebook-3-as-a-developer-laptop/</link>
      <pubDate>Wed, 07 Mar 2018</pubDate>
      <author>russell.parker7@gmail.com (Russell Parker)</author>
      <guid>https://russellparker.me/post/2018/03/07/samsung-chromebook-3-as-a-developer-laptop/</guid>
      <description>

&lt;h3 id=&#34;picking-a-laptop&#34;&gt;Picking a Laptop&lt;/h3&gt;

&lt;p&gt;After my last machine broke down last summer I needed a new laptop. I&amp;rsquo;d
been using an ancient HP Pavillion g6 which was bulky and had a dismal battery
life (less than 30 minutes) that had finally begun failing after years
of service.&lt;/p&gt;

&lt;p&gt;My requirements in a laptop are pretty low-spec. I have no need for a powerful CPU,
huge amounts RAM, a discrete graphics card, or even large storage. My
programming workflows don&amp;rsquo;t involve running VMs or compiling massive codebases
so my heaviest workloads are basically streaming Netflix and using
JavaScript-heavy web apps. My priorities are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;long battery life&lt;/li&gt;
&lt;li&gt;low cost&lt;/li&gt;
&lt;li&gt;small &amp;amp; lightweight&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It turns out that there aren&amp;rsquo;t a ton of modern laptops that match this criteria.
Chromebooks are one of the few products that strike a balance I was happy with.&lt;/p&gt;

&lt;p&gt;After far too much research, I picked up a
&lt;a href=&#34;https://www.samsung.com/us/support/owners/product/chromebook-3#productInfo&#34;&gt;Samsung Chromebook 3&lt;/a&gt;.
It has a dual-core Intel Braswell processor, 4GB of RAM, an 11&amp;rdquo; display, and
weighs in at just two and a half pounds. Although prices have bounced higher
recently, I saw it selling on Black Friday for $120. It comes with a minuscule
amount of storage (mine&amp;rsquo;s got 16GB of SSD) but has a micro SD card slot to
expand with.&lt;/p&gt;

&lt;h3 id=&#34;galliumos&#34;&gt;GalliumOS&lt;/h3&gt;

&lt;p&gt;I decided to install &lt;a href=&#34;https://galliumos.org/&#34;&gt;GalliumOS&lt;/a&gt; as a Linux distro to
replace ChromeOS (the OS that Chromebooks ship with). GalliumOS is Ubuntu-based
and designed for Chromebooks.&lt;/p&gt;

&lt;p&gt;&lt;a href=&#34;https://wiki.galliumos.org/Installing&#34;&gt;Installing&lt;/a&gt; involved a few extra steps
before beginning the normal Linux ISO install process:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Enabling Developer Mode on the Chromebook&lt;/li&gt;
&lt;li&gt;Removing the write-protect screw&lt;sup class=&#34;footnote-ref&#34; id=&#34;fnref:1&#34;&gt;&lt;a rel=&#34;footnote&#34; href=&#34;#fn:1&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://wiki.galliumos.org/Firmware&#34;&gt;Flashing custom firmware&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The &lt;a href=&#34;https://wiki.galliumos.org/&#34;&gt;GalliumOS wiki&lt;/a&gt; provides a guide as well
as a useful table for
&lt;a href=&#34;https://wiki.galliumos.org/Hardware_Compatibility#GalliumOS_Support_by_Model&#34;&gt;hardware support&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&#34;experience-review&#34;&gt;Experience review&lt;/h3&gt;

&lt;p&gt;I&amp;rsquo;ve really enjoyed using the Chromebook so far. It&amp;rsquo;s pretty snappy,
really light, and the battery life is unreal. The portability is further enhanced
because it&amp;rsquo;s so cheap to replace that I don&amp;rsquo;t second-guess taking it places
where it could stolen or broken. I think it&amp;rsquo;s ideal for developers who are
looking for a basic, no-frills laptop.&lt;/p&gt;

&lt;p&gt;There have definitely been some issues. The built-in microphone currently only
records static. Switching audio output when plugging in/out headphones took some
effort to sort out. I had a recurring problem where audio would occasionally
break when suspending under memory load.&lt;/p&gt;

&lt;p&gt;Things aren&amp;rsquo;t perfect but because GalliumOS focuses on supporting ChromeOS
devices the community is aggressive about fixing things that could easily fall
by the wayside with larger distros. One of the project maintainers writes&lt;sup class=&#34;footnote-ref&#34; id=&#34;fnref:2&#34;&gt;&lt;a rel=&#34;footnote&#34; href=&#34;#fn:2&#34;&gt;2&lt;/a&gt;&lt;/sup&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;We have a history of fixing audio (in/out) on ChromeOS devices even when it
is not fixed upstream or in other distros, and it is a priority for us&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Overall I&amp;rsquo;m pretty happy with my Samsung Chromebook 3 and I think it&amp;rsquo;s a great
option as a simple Linux machine.&lt;/p&gt;
&lt;div class=&#34;footnotes&#34;&gt;

&lt;hr /&gt;

&lt;ol&gt;
&lt;li id=&#34;fn:1&#34;&gt;I used &lt;a href=&#34;https://maxwyb.github.io/linux/2016/11/04/chromebook-write-protection.html&#34;&gt;this great guide&lt;/a&gt; for removing the Samsung Chromebook 3 write-protect screw
 &lt;a class=&#34;footnote-return&#34; href=&#34;#fnref:1&#34;&gt;↩&lt;/a&gt;&lt;/li&gt;
&lt;li id=&#34;fn:2&#34;&gt;&lt;a href=&#34;https://github.com/GalliumOS/galliumos-distro/issues/319#issuecomment-287590365&#34;&gt;Source&lt;/a&gt;
 &lt;a class=&#34;footnote-return&#34; href=&#34;#fnref:2&#34;&gt;↩&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>Plotting Website Loads with HAR and gnuplot</title>
      <link>https://russellparker.me/post/2018/02/26/plotting-website-loads/</link>
      <pubDate>Mon, 26 Feb 2018</pubDate>
      <author>russell.parker7@gmail.com (Russell Parker)</author>
      <guid>https://russellparker.me/post/2018/02/26/plotting-website-loads/</guid>
      <description>

&lt;p&gt;It&amp;rsquo;s super useful to analyze the performance of websites and there are some
great tools out there like
&lt;a href=&#34;https://developers.google.com/speed/pagespeed/insights/&#34;&gt;Google PageSpeed Insignts&lt;/a&gt;
and &lt;a href=&#34;http://www.webpagetest.org/&#34;&gt;WebPageTest&lt;/a&gt;. One shortfall is they do not let
you customize the output much, and I would really like to be able to create a
nice waterfall diagram. &lt;a href=&#34;http://www.softwareishard.com/blog/har-12-spec/&#34;&gt;HAR&lt;/a&gt;
steps in as a format standard for capturing and exporting HTTP network data and
opens the door to do-it-yourself diagram plotting.&lt;/p&gt;

&lt;h3 id=&#34;generating-a-har-archive&#34;&gt;Generating a HAR archive&lt;/h3&gt;

&lt;p&gt;Exporting to HAR format is built-in for Chrome. As explained
&lt;a href=&#34;http://devtoolsecrets.com/secret/performance-export-the-network-timeline-as-har.html&#34;&gt;here&lt;/a&gt;,
from the Network tab under Developer tools you can simply right-click and export
the current HTTP network data as HAR.&lt;/p&gt;

&lt;p&gt;Firefox needs an extension to handle exporting to HAR;
&lt;a href=&#34;http://www.softwareishard.com/blog/netexport/&#34;&gt;NetExport&lt;/a&gt; was recommended but
the project looks abandoned now and isn&amp;rsquo;t available as a
&lt;a href=&#34;https://addons.mozilla.org/&#34;&gt;Firefox Add-On&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&#34;plotting-with-gnuplot&#34;&gt;Plotting with gnuplot&lt;/h3&gt;

&lt;p&gt;Among the &lt;a href=&#34;https://har.tech/&#34;&gt;collection of projects&lt;/a&gt; related to HAR is
&lt;a href=&#34;https://github.com/fh-salzburg/har2gnuplot&#34;&gt;har2gnuplot&lt;/a&gt;. It&amp;rsquo;s a handy tool
that creates a waterfall plot in &lt;a href=&#34;http://www.gnuplot.info/&#34;&gt;gnuplot&lt;/a&gt; and saves
the result as a PNG image.&lt;/p&gt;

&lt;p&gt;To get the project up and running on Ubuntu:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ git clone git@github.com:fh-salzburg/har2gnuplot.git
$ sudo apt install -y nodejs gnuplot
$ npm install underscore module cli
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now, after copying a .har file into the project directory and running &lt;code&gt;make&lt;/code&gt;,
a PNG and .gnu file will be generated. After some tweaks with the axes and
legend, I got:&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;https://russellparker.me/img/loads.png&#34; alt=&#34;Waterfall diagram of HTTP network activity&#34; /&gt;&lt;/p&gt;

&lt;p&gt;Aside from the missing URIs, this image would be perfect to drop into a document
or website to visualize resource load times.&lt;/p&gt;

&lt;p&gt;Maybe if I have some time I&amp;rsquo;ll work on a har2gnuplot clone in Python with
&lt;a href=&#34;https://pypi.python.org/pypi/haralyzer/1.4.11&#34;&gt;haralyzer&lt;/a&gt; and
&lt;a href=&#34;https://pypi.python.org/pypi/gnuplot-py/1.8&#34;&gt;gnuplot-py&lt;/a&gt; to add URI labels and
learn more about gnuplot.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Adding Colors to man</title>
      <link>https://russellparker.me/post/2018/02/23/adding-colors-to-man/</link>
      <pubDate>Fri, 23 Feb 2018</pubDate>
      <author>russell.parker7@gmail.com (Russell Parker)</author>
      <guid>https://russellparker.me/post/2018/02/23/adding-colors-to-man/</guid>
      <description>

&lt;h3 id=&#34;color-configuration&#34;&gt;Color configuration&lt;/h3&gt;

&lt;p&gt;A somewhat well-known configuration for &lt;code&gt;man&lt;/code&gt; is enabling colors.
&lt;a href=&#34;https://unix.stackexchange.com/a/108840&#34;&gt;This StackExchange answer&lt;/a&gt;
provides a great intro to the technologies behind colorizing manpages while
&lt;a href=&#34;https://unix.stackexchange.com/a/147&#34;&gt;this one&lt;/a&gt; serves as a more practical
guide to getting things working.&lt;/p&gt;

&lt;p&gt;The gist is that you can add something like the following to your
.bashrc&lt;sup class=&#34;footnote-ref&#34; id=&#34;fnref:1&#34;&gt;&lt;a rel=&#34;footnote&#34; href=&#34;#fn:1&#34;&gt;1&lt;/a&gt;&lt;/sup&gt; file:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# ~/.bashrc

export MANROFFOPT=&#39;-c&#39;

export LESS_TERMCAP_mb=$(tput bold; tput setaf 2)
export LESS_TERMCAP_md=$(tput bold; tput setaf 6)
export LESS_TERMCAP_me=$(tput sgr0)
export LESS_TERMCAP_so=$(tput bold; tput setaf 3; tput setab 4)
export LESS_TERMCAP_se=$(tput rmso; tput sgr0)
export LESS_TERMCAP_us=$(tput smul; tput bold; tput setaf 7)
export LESS_TERMCAP_ue=$(tput rmul; tput sgr0)
export LESS_TERMCAP_mr=$(tput rev)
export LESS_TERMCAP_mh=$(tput dim)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Resulting in:&lt;/p&gt;

&lt;pre&gt;
MAN(1)                        Manual pager utils                        MAN(1)

&lt;span class=&#34;cyan bold&#34;&gt;NAME&lt;/span&gt;
       man - an interface to the on-line reference manuals

&lt;span class=&#34;cyan bold&#34;&gt;SYNOPSIS&lt;/span&gt;
       &lt;span class=&#34;cyan bold&#34;&gt;man&lt;/span&gt;  [&lt;span class=&#34;cyan bold&#34;&gt;-C&lt;/span&gt; &lt;span class=&#34;white underline bold&#34;&gt;file&lt;/span&gt;]  [&lt;span class=&#34;cyan bold&#34;&gt;-d&lt;/span&gt;]  [&lt;span class=&#34;cyan bold&#34;&gt;-D&lt;/span&gt;]  [&lt;span class=&#34;cyan bold&#34;&gt;--warnings&lt;/span&gt;[=&lt;span class=&#34;white underline bold&#34;&gt;warnings&lt;/span&gt;]]  [&lt;span class=&#34;cyan bold&#34;&gt;-R&lt;/span&gt; &lt;span class=&#34;white underline bold&#34;&gt;encoding&lt;/span&gt;] [&lt;span class=&#34;cyan bold&#34;&gt;-L&lt;/span&gt;
       &lt;span class=&#34;white underline bold&#34;&gt;locale&lt;/span&gt;] [&lt;span class=&#34;cyan bold&#34;&gt;-m&lt;/span&gt; &lt;span class=&#34;white underline bold&#34;&gt;system&lt;/span&gt;[,...]] [&lt;span class=&#34;cyan bold&#34;&gt;-M&lt;/span&gt; &lt;span class=&#34;white underline bold&#34;&gt;path&lt;/span&gt;] [&lt;span class=&#34;cyan bold&#34;&gt;-S&lt;/span&gt; &lt;span class=&#34;white underline bold&#34;&gt;list&lt;/span&gt;]  [&lt;span class=&#34;cyan bold&#34;&gt;-e&lt;/span&gt; &lt;span class=&#34;white underline bold&#34;&gt;extension&lt;/span&gt;]  [&lt;span class=&#34;cyan bold&#34;&gt;-i&lt;/span&gt;|&lt;span class=&#34;cyan bold&#34;&gt;-I&lt;/span&gt;]
       [&lt;span class=&#34;cyan bold&#34;&gt;--regex&lt;/span&gt;|&lt;span class=&#34;cyan bold&#34;&gt;--wildcard&lt;/span&gt;]   [&lt;span class=&#34;cyan bold&#34;&gt;--names-only&lt;/span&gt;]  [&lt;span class=&#34;cyan bold&#34;&gt;-a&lt;/span&gt;]  [&lt;span class=&#34;cyan bold&#34;&gt;-u&lt;/span&gt;]  [&lt;span class=&#34;cyan bold&#34;&gt;--no-subpages&lt;/span&gt;]  [&lt;span class=&#34;cyan bold&#34;&gt;-P&lt;/span&gt;
       &lt;span class=&#34;white underline bold&#34;&gt;pager&lt;/span&gt;] [&lt;span class=&#34;cyan bold&#34;&gt;-r&lt;/span&gt; &lt;span class=&#34;white underline bold&#34;&gt;prompt&lt;/span&gt;] [&lt;span class=&#34;cyan bold&#34;&gt;-7&lt;/span&gt;] [&lt;span class=&#34;cyan bold&#34;&gt;-E&lt;/span&gt; &lt;span class=&#34;white underline bold&#34;&gt;encoding&lt;/span&gt;] [&lt;span class=&#34;cyan bold&#34;&gt;--no-hyphenation&lt;/span&gt;] [&lt;span class=&#34;cyan bold&#34;&gt;--no-justifi‐&lt;/span&gt;
       &lt;span class=&#34;cyan bold&#34;&gt;cation&lt;/span&gt;]  [&lt;span class=&#34;cyan bold&#34;&gt;-p&lt;/span&gt; &lt;span class=&#34;white underline bold&#34;&gt;string&lt;/span&gt;]  [&lt;span class=&#34;cyan bold&#34;&gt;-t&lt;/span&gt;]  [&lt;span class=&#34;cyan bold&#34;&gt;-T&lt;/span&gt;[&lt;span class=&#34;white underline bold&#34;&gt;device&lt;/span&gt;]]  [&lt;span class=&#34;cyan bold&#34;&gt;-H&lt;/span&gt;[&lt;span class=&#34;white underline bold&#34;&gt;browser&lt;/span&gt;]] [&lt;span class=&#34;cyan bold&#34;&gt;-X&lt;/span&gt;[&lt;span class=&#34;white underline bold&#34;&gt;dpi&lt;/span&gt;]] [&lt;span class=&#34;cyan bold&#34;&gt;-Z&lt;/span&gt;]
       [[&lt;span class=&#34;white underline bold&#34;&gt;section&lt;/span&gt;] &lt;span class=&#34;white underline bold&#34;&gt;page&lt;/span&gt; ...] ...
       &lt;span class=&#34;cyan bold&#34;&gt;man&lt;/span&gt; &lt;span class=&#34;cyan bold&#34;&gt;-k&lt;/span&gt; [&lt;span class=&#34;white underline bold&#34;&gt;apropos&lt;/span&gt; &lt;span class=&#34;white underline bold&#34;&gt;options&lt;/span&gt;] &lt;span class=&#34;white underline bold&#34;&gt;regexp&lt;/span&gt; ...
       &lt;span class=&#34;cyan bold&#34;&gt;man&lt;/span&gt; &lt;span class=&#34;cyan bold&#34;&gt;-K&lt;/span&gt; [&lt;span class=&#34;cyan bold&#34;&gt;-w&lt;/span&gt;|&lt;span class=&#34;cyan bold&#34;&gt;-W&lt;/span&gt;] [&lt;span class=&#34;cyan bold&#34;&gt;-S&lt;/span&gt; &lt;span class=&#34;white underline bold&#34;&gt;list&lt;/span&gt;] [&lt;span class=&#34;cyan bold&#34;&gt;-i&lt;/span&gt;|&lt;span class=&#34;cyan bold&#34;&gt;-I&lt;/span&gt;] [&lt;span class=&#34;white underline bold&#34;&gt;--regex&lt;/span&gt;] [&lt;span class=&#34;white underline bold&#34;&gt;section&lt;/span&gt;] &lt;span class=&#34;white underline bold&#34;&gt;term&lt;/span&gt; ...
       &lt;span class=&#34;cyan bold&#34;&gt;man&lt;/span&gt; &lt;span class=&#34;cyan bold&#34;&gt;-f&lt;/span&gt; [&lt;span class=&#34;white underline bold&#34;&gt;whatis&lt;/span&gt; &lt;span class=&#34;white underline bold&#34;&gt;options&lt;/span&gt;] &lt;span class=&#34;white underline bold&#34;&gt;page&lt;/span&gt; ...
       &lt;span class=&#34;cyan bold&#34;&gt;man&lt;/span&gt; &lt;span class=&#34;cyan bold&#34;&gt;-l&lt;/span&gt; [&lt;span class=&#34;cyan bold&#34;&gt;-C&lt;/span&gt; &lt;span class=&#34;white underline bold&#34;&gt;file&lt;/span&gt;] [&lt;span class=&#34;cyan bold&#34;&gt;-d&lt;/span&gt;] [&lt;span class=&#34;cyan bold&#34;&gt;-D&lt;/span&gt;] [&lt;span class=&#34;cyan bold&#34;&gt;--warnings&lt;/span&gt;[=&lt;span class=&#34;white underline bold&#34;&gt;warnings&lt;/span&gt;]]  [&lt;span class=&#34;cyan bold&#34;&gt;-R&lt;/span&gt; &lt;span class=&#34;white underline bold&#34;&gt;encoding&lt;/span&gt;]  [&lt;span class=&#34;cyan bold&#34;&gt;-L&lt;/span&gt;
       &lt;span class=&#34;white underline bold&#34;&gt;locale&lt;/span&gt;]  [&lt;span class=&#34;cyan bold&#34;&gt;-P&lt;/span&gt; &lt;span class=&#34;white underline bold&#34;&gt;pager&lt;/span&gt;]  [&lt;span class=&#34;cyan bold&#34;&gt;-r&lt;/span&gt; &lt;span class=&#34;white underline bold&#34;&gt;prompt&lt;/span&gt;]  [&lt;span class=&#34;cyan bold&#34;&gt;-7&lt;/span&gt;] [&lt;span class=&#34;cyan bold&#34;&gt;-E&lt;/span&gt; &lt;span class=&#34;white underline bold&#34;&gt;encoding&lt;/span&gt;] [&lt;span class=&#34;cyan bold&#34;&gt;-p&lt;/span&gt; &lt;span class=&#34;white underline bold&#34;&gt;string&lt;/span&gt;] [&lt;span class=&#34;cyan bold&#34;&gt;-t&lt;/span&gt;]
       [&lt;span class=&#34;cyan bold&#34;&gt;-T&lt;/span&gt;[&lt;span class=&#34;white underline bold&#34;&gt;device&lt;/span&gt;]] [&lt;span class=&#34;cyan bold&#34;&gt;-H&lt;/span&gt;[&lt;span class=&#34;white underline bold&#34;&gt;browser&lt;/span&gt;]] [&lt;span class=&#34;cyan bold&#34;&gt;-X&lt;/span&gt;[&lt;span class=&#34;white underline bold&#34;&gt;dpi&lt;/span&gt;]] [&lt;span class=&#34;cyan bold&#34;&gt;-Z&lt;/span&gt;] &lt;span class=&#34;white underline bold&#34;&gt;file&lt;/span&gt; ...
       &lt;span class=&#34;cyan bold&#34;&gt;man&lt;/span&gt; &lt;span class=&#34;cyan bold&#34;&gt;-w&lt;/span&gt;|&lt;span class=&#34;cyan bold&#34;&gt;-W&lt;/span&gt; [&lt;span class=&#34;cyan bold&#34;&gt;-C&lt;/span&gt; &lt;span class=&#34;white underline bold&#34;&gt;file&lt;/span&gt;] [&lt;span class=&#34;cyan bold&#34;&gt;-d&lt;/span&gt;] [&lt;span class=&#34;cyan bold&#34;&gt;-D&lt;/span&gt;] &lt;span class=&#34;white underline bold&#34;&gt;page&lt;/span&gt; ...
       &lt;span class=&#34;cyan bold&#34;&gt;man&lt;/span&gt; &lt;span class=&#34;cyan bold&#34;&gt;-c&lt;/span&gt; [&lt;span class=&#34;cyan bold&#34;&gt;-C&lt;/span&gt; &lt;span class=&#34;white underline bold&#34;&gt;file&lt;/span&gt;] [&lt;span class=&#34;cyan bold&#34;&gt;-d&lt;/span&gt;] [&lt;span class=&#34;cyan bold&#34;&gt;-D&lt;/span&gt;] &lt;span class=&#34;white underline bold&#34;&gt;page&lt;/span&gt; ...
       &lt;span class=&#34;cyan bold&#34;&gt;man&lt;/span&gt; [&lt;span class=&#34;cyan bold&#34;&gt;-?V&lt;/span&gt;]

&lt;span class=&#34;cyan bold&#34;&gt;DESCRIPTION&lt;/span&gt;
&lt;span class=&#34;yellow bg-blue bold&#34;&gt; Manual page man(1) line 1 (press h for help or q to quit)&lt;/span&gt;
&lt;/pre&gt;

&lt;h3 id=&#34;how-does-this-work&#34;&gt;How does this work?&lt;/h3&gt;

&lt;p&gt;To understand how the above environment variables work it helps to review
what steps normally happen when viewing a manpage:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;code&gt;man&lt;/code&gt; renders a page from a (likely compressed) nroff or troff/groff
document and pipes the result it into the pager program, usually &lt;code&gt;less&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;If the piped text indicates formatting that needs to be performed then
&lt;code&gt;less&lt;/code&gt; has to figure out how to accomplish this for terminal output&lt;/li&gt;
&lt;li&gt;&lt;code&gt;less&lt;/code&gt; uses the (deprecated) termcap database to look up how to achieve
effects like underline and bold. In reality it ends up using termcap&amp;rsquo;s
successor, the terminfo database, which maintains support for the termcap
interface. This gives back an escape string which corresponds to the specified
effect for your particular terminal&lt;/li&gt;
&lt;li&gt;Using these nifty escape strings, &lt;code&gt;less&lt;/code&gt; finally displays the manpage to
the user&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Manpages use formatting like bold (for sections) and underlines (for things
like file names and arguments). These should already work out of the box when
using the &lt;code&gt;man&lt;/code&gt; command but will not change the text color.&lt;/p&gt;

&lt;pre&gt;
MAN(1)                        Manual pager utils                        MAN(1)

&lt;span class=&#34;bold&#34;&gt;NAME&lt;/span&gt;
       man - an interface to the on-line reference manuals

&lt;span class=&#34;bold&#34;&gt;SYNOPSIS&lt;/span&gt;
       &lt;span class=&#34;bold&#34;&gt;man&lt;/span&gt;  [&lt;span class=&#34;bold&#34;&gt;-C&lt;/span&gt; &lt;span class=&#34;underline&#34;&gt;file&lt;/span&gt;]  [&lt;span class=&#34;bold&#34;&gt;-d&lt;/span&gt;]  [&lt;span class=&#34;bold&#34;&gt;-D&lt;/span&gt;]  [&lt;span class=&#34;bold&#34;&gt;--warnings&lt;/span&gt;[=&lt;span class=&#34;underline&#34;&gt;warnings&lt;/span&gt;]]  [&lt;span class=&#34;bold&#34;&gt;-R&lt;/span&gt; &lt;span class=&#34;underline&#34;&gt;encoding&lt;/span&gt;] [&lt;span class=&#34;bold&#34;&gt;-L&lt;/span&gt;
       &lt;span class=&#34;underline&#34;&gt;locale&lt;/span&gt;] [&lt;span class=&#34;bold&#34;&gt;-m&lt;/span&gt; &lt;span class=&#34;underline&#34;&gt;system&lt;/span&gt;[,...]] [&lt;span class=&#34;bold&#34;&gt;-M&lt;/span&gt; &lt;span class=&#34;underline&#34;&gt;path&lt;/span&gt;] [&lt;span class=&#34;bold&#34;&gt;-S&lt;/span&gt; &lt;span class=&#34;underline&#34;&gt;list&lt;/span&gt;]  [&lt;span class=&#34;bold&#34;&gt;-e&lt;/span&gt; &lt;span class=&#34;underline&#34;&gt;extension&lt;/span&gt;]  [&lt;span class=&#34;bold&#34;&gt;-i&lt;/span&gt;|&lt;span class=&#34;bold&#34;&gt;-I&lt;/span&gt;]
       [&lt;span class=&#34;bold&#34;&gt;--regex&lt;/span&gt;|&lt;span class=&#34;bold&#34;&gt;--wildcard&lt;/span&gt;]   [&lt;span class=&#34;bold&#34;&gt;--names-only&lt;/span&gt;]  [&lt;span class=&#34;bold&#34;&gt;-a&lt;/span&gt;]  [&lt;span class=&#34;bold&#34;&gt;-u&lt;/span&gt;]  [&lt;span class=&#34;bold&#34;&gt;--no-subpages&lt;/span&gt;]  [&lt;span class=&#34;bold&#34;&gt;-P&lt;/span&gt;
       &lt;span class=&#34;underline&#34;&gt;pager&lt;/span&gt;] [&lt;span class=&#34;bold&#34;&gt;-r&lt;/span&gt; &lt;span class=&#34;underline&#34;&gt;prompt&lt;/span&gt;] [&lt;span class=&#34;bold&#34;&gt;-7&lt;/span&gt;] [&lt;span class=&#34;bold&#34;&gt;-E&lt;/span&gt; &lt;span class=&#34;underline&#34;&gt;encoding&lt;/span&gt;] [&lt;span class=&#34;bold&#34;&gt;--no-hyphenation&lt;/span&gt;] [&lt;span class=&#34;bold&#34;&gt;--no-justifi-&lt;/span&gt;
       &lt;span class=&#34;bold&#34;&gt;cation&lt;/span&gt;]  [&lt;span class=&#34;bold&#34;&gt;-p&lt;/span&gt; &lt;span class=&#34;underline&#34;&gt;string&lt;/span&gt;]  [&lt;span class=&#34;bold&#34;&gt;-t&lt;/span&gt;]  [&lt;span class=&#34;bold&#34;&gt;-T&lt;/span&gt;[&lt;span class=&#34;underline&#34;&gt;device&lt;/span&gt;]]  [&lt;span class=&#34;bold&#34;&gt;-H&lt;/span&gt;[&lt;span class=&#34;underline&#34;&gt;browser&lt;/span&gt;]] [&lt;span class=&#34;bold&#34;&gt;-X&lt;/span&gt;[&lt;span class=&#34;underline&#34;&gt;dpi&lt;/span&gt;]] [&lt;span class=&#34;bold&#34;&gt;-Z&lt;/span&gt;]
       [[&lt;span class=&#34;underline&#34;&gt;section&lt;/span&gt;] &lt;span class=&#34;underline&#34;&gt;page&lt;/span&gt; ...] ...
       &lt;span class=&#34;bold&#34;&gt;man&lt;/span&gt; &lt;span class=&#34;bold&#34;&gt;-k&lt;/span&gt; [&lt;span class=&#34;underline&#34;&gt;apropos&lt;/span&gt; &lt;span class=&#34;underline&#34;&gt;options&lt;/span&gt;] &lt;span class=&#34;underline&#34;&gt;regexp&lt;/span&gt; ...
       &lt;span class=&#34;bold&#34;&gt;man&lt;/span&gt; &lt;span class=&#34;bold&#34;&gt;-K&lt;/span&gt; [&lt;span class=&#34;bold&#34;&gt;-w&lt;/span&gt;|&lt;span class=&#34;bold&#34;&gt;-W&lt;/span&gt;] [&lt;span class=&#34;bold&#34;&gt;-S&lt;/span&gt; &lt;span class=&#34;underline&#34;&gt;list&lt;/span&gt;] [&lt;span class=&#34;bold&#34;&gt;-i&lt;/span&gt;|&lt;span class=&#34;bold&#34;&gt;-I&lt;/span&gt;] [&lt;span class=&#34;underline&#34;&gt;--regex&lt;/span&gt;] [&lt;span class=&#34;underline&#34;&gt;section&lt;/span&gt;] &lt;span class=&#34;underline&#34;&gt;term&lt;/span&gt; ...
       &lt;span class=&#34;bold&#34;&gt;man&lt;/span&gt; &lt;span class=&#34;bold&#34;&gt;-f&lt;/span&gt; [&lt;span class=&#34;underline&#34;&gt;whatis&lt;/span&gt; &lt;span class=&#34;underline&#34;&gt;options&lt;/span&gt;] &lt;span class=&#34;underline&#34;&gt;page&lt;/span&gt; ...
       &lt;span class=&#34;bold&#34;&gt;man&lt;/span&gt; &lt;span class=&#34;bold&#34;&gt;-l&lt;/span&gt; [&lt;span class=&#34;bold&#34;&gt;-C&lt;/span&gt; &lt;span class=&#34;underline&#34;&gt;file&lt;/span&gt;] [&lt;span class=&#34;bold&#34;&gt;-d&lt;/span&gt;] [&lt;span class=&#34;bold&#34;&gt;-D&lt;/span&gt;] [&lt;span class=&#34;bold&#34;&gt;--warnings&lt;/span&gt;[=&lt;span class=&#34;underline&#34;&gt;warnings&lt;/span&gt;]]  [&lt;span class=&#34;bold&#34;&gt;-R&lt;/span&gt; &lt;span class=&#34;underline&#34;&gt;encoding&lt;/span&gt;]  [&lt;span class=&#34;bold&#34;&gt;-L&lt;/span&gt;
       &lt;span class=&#34;underline&#34;&gt;locale&lt;/span&gt;]  [&lt;span class=&#34;bold&#34;&gt;-P&lt;/span&gt; &lt;span class=&#34;underline&#34;&gt;pager&lt;/span&gt;]  [&lt;span class=&#34;bold&#34;&gt;-r&lt;/span&gt; &lt;span class=&#34;underline&#34;&gt;prompt&lt;/span&gt;]  [&lt;span class=&#34;bold&#34;&gt;-7&lt;/span&gt;] [&lt;span class=&#34;bold&#34;&gt;-E&lt;/span&gt; &lt;span class=&#34;underline&#34;&gt;encoding&lt;/span&gt;] [&lt;span class=&#34;bold&#34;&gt;-p&lt;/span&gt; &lt;span class=&#34;underline&#34;&gt;string&lt;/span&gt;] [&lt;span class=&#34;bold&#34;&gt;-t&lt;/span&gt;]
       [&lt;span class=&#34;bold&#34;&gt;-T&lt;/span&gt;[&lt;span class=&#34;underline&#34;&gt;device&lt;/span&gt;]] [&lt;span class=&#34;bold&#34;&gt;-H&lt;/span&gt;[&lt;span class=&#34;underline&#34;&gt;browser&lt;/span&gt;]] [&lt;span class=&#34;bold&#34;&gt;-X&lt;/span&gt;[&lt;span class=&#34;underline&#34;&gt;dpi&lt;/span&gt;]] [&lt;span class=&#34;bold&#34;&gt;-Z&lt;/span&gt;] &lt;span class=&#34;underline&#34;&gt;file&lt;/span&gt; ...
       &lt;span class=&#34;bold&#34;&gt;man&lt;/span&gt; &lt;span class=&#34;bold&#34;&gt;-w&lt;/span&gt;|&lt;span class=&#34;bold&#34;&gt;-W&lt;/span&gt; [&lt;span class=&#34;bold&#34;&gt;-C&lt;/span&gt; &lt;span class=&#34;underline&#34;&gt;file&lt;/span&gt;] [&lt;span class=&#34;bold&#34;&gt;-d&lt;/span&gt;] [&lt;span class=&#34;bold&#34;&gt;-D&lt;/span&gt;] &lt;span class=&#34;underline&#34;&gt;page&lt;/span&gt; ...
       &lt;span class=&#34;bold&#34;&gt;man&lt;/span&gt; &lt;span class=&#34;bold&#34;&gt;-c&lt;/span&gt; [&lt;span class=&#34;bold&#34;&gt;-C&lt;/span&gt; &lt;span class=&#34;underline&#34;&gt;file&lt;/span&gt;] [&lt;span class=&#34;bold&#34;&gt;-d&lt;/span&gt;] [&lt;span class=&#34;bold&#34;&gt;-D&lt;/span&gt;] &lt;span class=&#34;underline&#34;&gt;page&lt;/span&gt; ...
       &lt;span class=&#34;bold&#34;&gt;man&lt;/span&gt; [&lt;span class=&#34;bold&#34;&gt;-?V&lt;/span&gt;]

&lt;span class=&#34;bold&#34;&gt;DESCRIPTION&lt;/span&gt;
&lt;span class=&#34;inverted bg-inverted&#34;&gt; Manual page man(1) line 1 (press h for help or q to quit)&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;For an idea of what capabilities &lt;code&gt;less&lt;/code&gt; queries from the termcap database,
a few of them (along with their terminfo database equivalents) are:&lt;/p&gt;

&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;terminfo capname&lt;/th&gt;
&lt;th&gt;termcap name&lt;/th&gt;
&lt;th&gt;description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;

&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;bold&lt;/td&gt;
&lt;td&gt;md&lt;/td&gt;
&lt;td&gt;turn on bold&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;blink&lt;/td&gt;
&lt;td&gt;mb&lt;/td&gt;
&lt;td&gt;turn on blinking&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;sgr0&lt;/td&gt;
&lt;td&gt;me&lt;/td&gt;
&lt;td&gt;turn off all attributes&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;smso&lt;/td&gt;
&lt;td&gt;so&lt;/td&gt;
&lt;td&gt;begin standout mode&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;rmso&lt;/td&gt;
&lt;td&gt;se&lt;/td&gt;
&lt;td&gt;exit standout mode&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;rev&lt;/td&gt;
&lt;td&gt;mr&lt;/td&gt;
&lt;td&gt;turn on reverse mode&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;dim&lt;/td&gt;
&lt;td&gt;mh&lt;/td&gt;
&lt;td&gt;turn on half-bright mode&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;rmul&lt;/td&gt;
&lt;td&gt;ue&lt;/td&gt;
&lt;td&gt;exit underline mode&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;smul&lt;/td&gt;
&lt;td&gt;us&lt;/td&gt;
&lt;td&gt;begin underline mode&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;h3 id=&#34;overwriting-escape-strings&#34;&gt;Overwriting Escape Strings&lt;/h3&gt;

&lt;p&gt;Depending on your system, by the time the manpage reaches &lt;code&gt;less&lt;/code&gt; it may already
be formatted with escape strings which means that &lt;code&gt;less&lt;/code&gt; does not have to do any
work to figure out how to display it. The
&lt;a href=&#34;https://linux.die.net/man/1/grotty&#34;&gt;&lt;code&gt;grotty&lt;/code&gt;&lt;/a&gt; manpage explains this behavior as
well as the &lt;code&gt;-c&lt;/code&gt; option which seems to apply to most nroff and troff/groff
rendering programs:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;By default, grotty emits SGR escape sequences (from ISO 6429, also called
ANSI color escapes) to change text attributes (bold, italic, colors).&lt;/p&gt;
&lt;/blockquote&gt;

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

&lt;blockquote&gt;
&lt;p&gt;Use the -c switch to revert to the old behaviour, printing a bold character c
with the sequence `c BACKSPACE c&amp;rsquo; and an italic character c by the sequence
`_ BACKSPACE c&amp;rsquo;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So the manpage rendering program assumes that our terminal interprets a few
basic ANSI color escape strings and makes use of them. This is a pretty safe
assumption because ANSI codes were standardized a long time ago and modern
terminal emulators conform to at least a subset of it.  But what if we want
to force &lt;code&gt;less&lt;/code&gt; to figure out the escape codes on its own? We can use the &lt;code&gt;-c&lt;/code&gt;
option to force the old behavior and we&amp;rsquo;ll have &lt;code&gt;man&lt;/code&gt; pass this option along
when it invokes the renderer by setting the &lt;code&gt;MANROFFOPT&lt;/code&gt; environment variable.&lt;/p&gt;

&lt;p&gt;A behavior that we ignored earlier is that &lt;code&gt;less&lt;/code&gt; actually looks for specific
environment variables before proceeding to query termcap. These follow the
format &lt;code&gt;LESS_TERMCAP_&lt;/code&gt; suffixed with a termcap name and manually define the
escape strings to use. By using these we can essentially &lt;strong&gt;lie&lt;/strong&gt; to &lt;code&gt;less&lt;/code&gt;
about how to achieve effects like bold so that bolding text also adds colors
to it.&lt;/p&gt;

&lt;h3 id=&#34;setting-specific-effects&#34;&gt;Setting Specific Effects&lt;/h3&gt;

&lt;p&gt;The &lt;a href=&#34;https://linux.die.net/man/1/tput&#34;&gt;&lt;code&gt;tput&lt;/code&gt;&lt;/a&gt; command abstracts over different
terminal types to output terminal-dependent escape sequences&lt;sup class=&#34;footnote-ref&#34; id=&#34;fnref:2&#34;&gt;&lt;a rel=&#34;footnote&#34; href=&#34;#fn:2&#34;&gt;2&lt;/a&gt;&lt;/sup&gt;. This makes the
configuration easier to maintain and will still work in the off-chance that your
terminal does not use the normal ANSI escape sequences.&lt;/p&gt;

&lt;p&gt;Most of the capnames used in the example are pretty self-explanatory. &lt;code&gt;setaf&lt;/code&gt;
and &lt;code&gt;setab&lt;/code&gt; set the foreground and background color, respectively, using the
color codes as defined in terminfo:&lt;/p&gt;

&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Color&lt;/th&gt;
&lt;th&gt;Code&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;

&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;black&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;red&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;green&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;yellow&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;blue&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;magenta&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;cyan&lt;/td&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;white&lt;/td&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;div class=&#34;footnotes&#34;&gt;

&lt;hr /&gt;

&lt;ol&gt;
&lt;li id=&#34;fn:1&#34;&gt;Really this kind of environment variable belongs in the relatively-unknown &lt;a href=&#34;https://linux.die.net/man/1/lesskey&#34;&gt;lesskey&lt;/a&gt; file which has the capability of setting environment variables specifically for &lt;code&gt;less&lt;/code&gt;. Unfortunately there is a bug in versions of &lt;code&gt;less&lt;/code&gt; below 530 explained well &lt;a href=&#34;https://unix.stackexchange.com/a/377221&#34;&gt;here&lt;/a&gt;
 &lt;a class=&#34;footnote-return&#34; href=&#34;#fnref:1&#34;&gt;↩&lt;/a&gt;&lt;/li&gt;
&lt;li id=&#34;fn:2&#34;&gt;These are horrible strings to write and look like &amp;ldquo;^[[33m&amp;rdquo;. The Bash Hackers Wiki has a &lt;a href=&#34;http://wiki.bash-hackers.org/scripting/terminalcodes&#34;&gt;great page&lt;/a&gt; on the topic. Try it out in the form &lt;code&gt;tput setaf 2 | cat -v&lt;/code&gt;
 &lt;a class=&#34;footnote-return&#34; href=&#34;#fnref:2&#34;&gt;↩&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>Bash Autocomplete for tmux</title>
      <link>https://russellparker.me/post/2018/02/16/tmux-bash-autocomplete/</link>
      <pubDate>Fri, 16 Feb 2018</pubDate>
      <author>russell.parker7@gmail.com (Russell Parker)</author>
      <guid>https://russellparker.me/post/2018/02/16/tmux-bash-autocomplete/</guid>
      <description>&lt;p&gt;I&amp;rsquo;ve recently become a big fan of &lt;a href=&#34;https://github.com/tmux/tmux&#34;&gt;tmux&lt;/a&gt; and have put far too much time into customizing my &lt;a href=&#34;https://github.com/rusty122/dotfiles/blob/master/tmux/.tmux.conf&#34;&gt;config file&lt;/a&gt;. When working in the terminal it helps me compartmentalize work and lets me come back a project right where I left off with all of my sessions and windows named to keep things organized. These features are useful when working locally but are a godsend when SSH&amp;rsquo;d into a remote machine because tmux can keep sessions alive over multiple SSH logins, allowing me to detach from a session and attach to the same one days later.&lt;/p&gt;

&lt;p&gt;The one big pain point so far has been tab-completion. Finding and reattaching to a session often looks like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ tmux list-sessions
session-1: 3 windows (created Fri Feb 16 16:37:48 2018) [80x23]
session-2: 4 windows (created Thu Feb  1 15:42:16 2018) [80x23]
session-3: 4 windows (created Tue Feb 13 16:09:11 2018) [80x64]
$ tmux attach-session -t session-1
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Bash will tab-complete &lt;code&gt;tmux&lt;/code&gt; but not the tmux command &lt;code&gt;attach-session&lt;/code&gt; or the specific session name. Having to type out all of this out can get annoying and with completion we could skip &lt;code&gt;tmux list-sessions&lt;/code&gt; entirely because hitting &lt;kbd&gt;Tab&lt;/kbd&gt; should list all of the running sessions for us.&lt;/p&gt;

&lt;p&gt;The tmux &lt;a href=&#34;https://github.com/tmux/tmux/blob/master/README&#34;&gt;README&lt;/a&gt; recommends using the wonderful &lt;a href=&#34;https://github.com/imomaliev/tmux-bash-completion&#34;&gt;tmux-bash-completion&lt;/a&gt; script for completions. It can be sourced from &lt;code&gt;.bashrc&lt;/code&gt; but this approach is way too easy. We need to keep our home directory clean from non-standard files.&lt;/p&gt;

&lt;p&gt;The &lt;a href=&#34;https://github.com/scop/bash-completion&#34;&gt;bash-completion&lt;/a&gt; package ships with Ubuntu and provides &lt;a href=&#34;https://github.com/scop/bash-completion/tree/master/completions&#34;&gt;a ton&lt;/a&gt; of completions but unfortunately does not support tmux out of the box (if it did we would&amp;rsquo;t be addressing this in the first place). One solution is just to save the recommended script to the bash-completion&amp;rsquo;s &lt;code&gt;completionsdir&lt;/code&gt; (which is &lt;code&gt;/usr/share/bash-completion/completions/&lt;/code&gt; on my system). This works fine if you have root privileges but is not portable across systems where you only have basic user privileges, which is the case for me on my university&amp;rsquo;s Linux servers. After running &lt;code&gt;sudo&lt;/code&gt; once on them (and quickly hitting &lt;kbd&gt;CTRL&lt;/kbd&gt;+&lt;kbd&gt;C&lt;/kbd&gt; once I realized what I had done), I learned that the admins really do not appreciate students trying to execute commands as root.&lt;/p&gt;

&lt;p&gt;A simple work-around is saving the tmux-bash-completion script as &lt;code&gt;~/.bash_completion&lt;/code&gt; which the bash-completion script will parse automatically. Other custom tab-completion scripts can live here as well and it allows you to easily manage the script alongside additional home directory dotfiles with &lt;a href=&#34;https://www.gnu.org/software/stow/&#34;&gt;GNU Stow&lt;/a&gt;. Perfect!&lt;/p&gt;

&lt;p&gt;Download with:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ curl https://raw.githubusercontent.com/imomaliev/tmux-bash-completion/master/completions/tmux &amp;gt; ~/.bash_completion
&lt;/code&gt;&lt;/pre&gt;
</description>
    </item>
    
  </channel>
</rss>
