<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>bash on S Anand</title>
    <link>https://www.s-anand.net/blog/tag/bash/</link>
    <description>Recent content in bash on S Anand</description>
    <generator>Hugo -- 0.164.0</generator>
    <language>en-us</language>
    <lastBuildDate>Sun, 05 Apr 2026 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://www.s-anand.net/blog/tag/bash/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Things I Learned - 05 Apr 2026</title>
      <link>https://www.s-anand.net/blog/things-i-learned-05-apr-2026/</link>
      <pubDate>Sun, 05 Apr 2026 00:00:00 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/things-i-learned-05-apr-2026/</guid>
      <description>&lt;p&gt;This week, I learned:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It&amp;rsquo;s pretty convenient (on Ubuntu) to be able to move windows around desktops. Apart from the usual Super + Arrow keys to manage windows within a desktop, you can use:
&lt;ul&gt;
&lt;li&gt;Ctrl + Alt + Left/Right Arrow: Move desktops&lt;/li&gt;
&lt;li&gt;Ctrl + Alt + Shift + Left/Right Arrow: Move window to desktop&lt;/li&gt;
&lt;li&gt;Super + Shift + Arrow: Move window to another monitor&lt;/li&gt;
&lt;li&gt;Super + Drag: Drag window from anywhere&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;jq . file.json&lt;/code&gt; is an efficient way to pretty-print JSON files in the terminal. (Or &lt;code&gt;jaq . file.json&lt;/code&gt;, which is ~30% faster.)&lt;/li&gt;
&lt;li&gt;GitHub Copilot monthly premium requests were &lt;em&gt;not&lt;/em&gt; reset at 12 am UTC&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://social.jvns.ca/@b0rk/116297197345549083&#34;&gt;How Diffie Hellman Key Exchange Works&lt;/a&gt; by Julia Evans is an &lt;em&gt;excellent&lt;/em&gt; explanation. Share a random number. A multiplies it by their private key and shares S&lt;em&gt;A. B multiplies it by their private key and shares S&lt;/em&gt;B. They multiply the others&amp;rsquo; key with their secret key and they get S&lt;em&gt;A&lt;/em&gt;B = S&lt;em&gt;B&lt;/em&gt;A. Now &lt;em&gt;both&lt;/em&gt; of them have the same &lt;em&gt;new&lt;/em&gt; secret they can encrypt/decrypt with, but no one else knows, even though they shared everything publicly! This may be one of the &lt;strong&gt;best&lt;/strong&gt; cool uses of math I&amp;rsquo;ve seen in a long time.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://blog.hofstede.it/shell-tricks-that-actually-make-life-easier-and-save-your-sanity/&#34;&gt;Shell tricks&lt;/a&gt; I didn&amp;rsquo;t know:
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# ALT + . cycles through the last arguments typed&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;mv file.&lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;txt,md&lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;    &lt;span class=&#34;c1&#34;&gt;# Move file.txt to file.md&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;ls &lt;span class=&#34;p&#34;&gt;|&amp;amp;&lt;/span&gt; tee file.txt  &lt;span class=&#34;c1&#34;&gt;# Pipe both stdout and stderr to tee&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    <item>
      <title>Command Line Slideshows in Bash</title>
      <link>https://www.s-anand.net/blog/command-line-slideshows-in-bash/</link>
      <pubDate>Wed, 26 Feb 2025 02:29:42 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/command-line-slideshows-in-bash/</guid>
      <description>&lt;p&gt;&lt;img alt=&#34;Command Line Slideshows in Bash&#34; loading=&#34;lazy&#34; src=&#34;https://www.s-anand.net/blog/assets/C__Downloads_7Xp8rR2uJjXtGXHKSwylyPkja.webp&#34;&gt;&lt;/p&gt;
&lt;p&gt;At &lt;a href=&#34;https://2025.pyconfhyd.org/&#34;&gt;PyConf Hyderabad&lt;/a&gt;, I spoke about &lt;a href=&#34;https://2025.pyconfhyd.org/speakers/s-anand&#34;&gt;uv&lt;/a&gt;. It&#39;s a package manager for Python.&lt;/p&gt;
&lt;p&gt;I usually &lt;em&gt;mix live demos&lt;/em&gt; into my narrative. So, rather than present with something static like PowerPoint (or Google Slides), I usually use:&lt;/p&gt;
&lt;ul class=&#34;wp-block-list&#34;&gt;
&lt;li&gt;&lt;strong&gt;Front-end&lt;/strong&gt;: Custom HTML mixed with &lt;a href=&#34;https://revealjs.com/&#34;&gt;RevealJS&lt;/a&gt; and &lt;a href=&#34;https://codepen.io/&#34;&gt;CodePen&lt;/a&gt;. &lt;a href=&#34;https://observablehq.com/&#34;&gt;Observable&lt;/a&gt; is a good, too.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Python&lt;/strong&gt;: &lt;a href=&#34;https://jupyter.org/&#34;&gt;Jupyter Notebooks&lt;/a&gt;. &lt;a href=&#34;https://marimo.com/&#34;&gt;Marimo&lt;/a&gt; is good, too.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Others&lt;/strong&gt;: &lt;a href=&#34;https://www.markdownguide.org/&#34;&gt;Markdown&lt;/a&gt; and &lt;a href=&#34;https://code.visualstudio.com/&#34;&gt;VS Code&lt;/a&gt; for most other things, e.g. SQL.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For this talk, I needed to run commands on the shell. I evaluated:&lt;/p&gt;
&lt;ul class=&#34;wp-block-list&#34;&gt;
&lt;li&gt;&lt;strong&gt;VS Code + Terminal&lt;/strong&gt;. Split screen is good. But slides in VS code were not obvious.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Web App&lt;/strong&gt;. Write a web shell with &lt;a href=&#34;https://xtermjs.org/&#34;&gt;xterm.js&lt;/a&gt; and &lt;a href=&#34;https://www.npmjs.com/package/node-pty&#34;&gt;node-pty&lt;/a&gt; and embed it in RevealJS. But it&#39;s too much work.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Web terminals&lt;/strong&gt;: &lt;a href=&#34;https://github.com/butlerx/wetty&#34;&gt;WeTTY&lt;/a&gt;, &lt;a href=&#34;https://github.com/tsl0922/ttyd&#34;&gt;ttyd&lt;/a&gt;, &lt;a href=&#34;https://github.com/yudai/gotty&#34;&gt;GoTTY&lt;/a&gt;, etc. But they struggle on Windows. I&#39;d need WSL or Docker.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;https://asciinema.org/&#34;&gt;Asciinema&lt;/a&gt;&lt;/strong&gt;. But it&#39;s not interactive.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So I &lt;a href=&#34;https://chatgpt.com/share/67b83b6f-30d8-800c-9ea2-549bffc645e0&#34;&gt;got ChatGPT to write me an app&lt;/a&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-markdown&#34; data-lang=&#34;markdown&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Write a modern, compact Python program that parses a Markdown file and renders it section-by-section colorfully on the terminal.
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;A &amp;#34;section&amp;#34; is any text beginning with a heading until the next heading.
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;-&lt;/span&gt; uv run talk.py script.md should parse script.md and render the first section.
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;-&lt;/span&gt; Running uv run talk.py should render the next section. And so on.
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;-&lt;/span&gt; If no further sections are found, it should say so and end.
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;When rendering on the terminal,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;-&lt;/span&gt; Headings should be very prominent. Highlight H1, H2 and H3 in decreasing order of prominence. Rest can be rendered normally
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;-&lt;/span&gt; **Bold** should be prominent. &lt;span class=&#34;ge&#34;&gt;_Italics_&lt;/span&gt; should be mildly emphasized.
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;-&lt;/span&gt; Code blocks and
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  code fences
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  should be colored distinctly.
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;-&lt;/span&gt; [&lt;span class=&#34;nt&#34;&gt;Links&lt;/span&gt;](&lt;span class=&#34;na&#34;&gt;...&lt;/span&gt;) should be colored distinctly but the URLs can be ignored.
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Use inline script dependencies. I think using rich and markdown2 would apt but you can decide.
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote class=&#34;wp-block-quote&#34;&gt;
&lt;p&gt;&lt;strong&gt;An aside&lt;/strong&gt;. These days, it&#39;s easier to &lt;em&gt;create&lt;/em&gt; small tools than &lt;em&gt;search&lt;/em&gt; for something that exists.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The &lt;a href=&#34;https://github.com/sanand0/uv-mega/blob/523a08bb8fae3246a35b55d39ffc5f93b1a7bf37/slide.py&#34;&gt;code it wrote&lt;/a&gt; works like this.&lt;/p&gt;
&lt;ol class=&#34;wp-block-list&#34;&gt;
&lt;li&gt;Write a Markdown file that has my &#34;slides&#34;. I used this &lt;a href=&#34;https://github.com/sanand0/uv-mega/blob/523a08bb8fae3246a35b55d39ffc5f93b1a7bf37/README.md&#34;&gt;README.md&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;slide.py README.md&lt;/code&gt;. It shows the first section (&#34;slide&#34;) in &lt;code&gt;README.md&lt;/code&gt;, colored and highlighted, and &lt;em&gt;exits&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;I can run any other commands on my shell, e.g. &lt;code&gt;uv run --with pandas,ipython ipython&lt;/code&gt;, and show how it works.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;slide.py&lt;/code&gt; again. It clears the screen and shows the next slide.&lt;/li&gt;
&lt;/ol&gt;
&lt;script async=&#34;true&#34; id=&#34;asciicast-7Xp8rR2uJjXtGXHKSwylyPkja&#34; src=&#34;https://asciinema.org/a/7Xp8rR2uJjXtGXHKSwylyPkja.js&#34;&gt;&lt;/script&gt;
&lt;p&gt;This allowed me a new kind of workflow, where the &lt;em&gt;shell itself&lt;/em&gt; is the slides layer.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;comments&#34;&gt;Comments&lt;/h2&gt;
&lt;!-- wp-comments-start --&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;https://www.s-anand.net/blog/voice-coding-is-the-new-live-coding/&#34;&gt;Voice coding is the new live coding - S Anand&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;21 Sep 2025 4:48 pm&lt;/em&gt; &lt;em&gt;(pingback)&lt;/em&gt;:
[…] In Feb 2025 at PyConf Hyderabad, I tried a new slide format: command-line slideshows in bash. […]&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- wp-comments-end --&gt;
</description>
    </item>
  </channel>
</rss>
