Drop #653 (2025-05-15): Command Line Thursday

mandown; freq; Biff

It’s been a minute since we had an all-CLI Drop, so today we’ve got three utilities I recently came across that each do one thing incredibly well.


TL;DR

(This is an LLM/GPT-generated summary of today’s Drop using Ollama + Qwen 3 and a custom prompt.)


mandown (mdn): Terminal-based Markdown Viewer

Mandown, now known as mdn, is a terminal-based Markdown viewer inspired by Unix man-pages. Written in C, it provides a familiar pager experience for reading Markdown documents directly in your terminal. While still under development, it already handles most Markdown files and offers several features that make it valuable for command-line users.

To use mandown, you’ll need three libraries at compile time: libncurses(w)libxml2, and libconfig. On Debian systems, install these via apt-get. macOS users can get mandown through Homebrew. After installation, the main executable “mdn” typically lives in /usr/local/bin/ (except on macOS). You can build from source by cloning the repository, running make, and optionally make install to add the binary to your system path. To uninstall, run make uninstall or manually remove the binary.

Mandown offers multiple control schemes including its own (mdn), vim-style, and less-style keybindings (less is the default). Navigation is simple: use arrow keys or j/k to move up and down, space or PgUp/PgDn to page through content, and q to exit. If your terminal supports it, mouse scrolling works too. Access hyperlinks with Tab + Enter or by double-clicking. The configuration file lives at ~/.config/mdn/mdnrc, allowing for customization.

You can also embed mandown in applications that support C-libraries. It provides functions to render Markdown from strings or files, with both static and shared libraries available. Linking against mandown requires including the appropriate headers and linking with the necessary dependencies.

Current development priorities include improving line wrapping, optimizing resizing, enhancing the Makefile, adding configuration options, and improving table rendering. If you find issues or have suggestions, consider creating an issue on the project’s GitHub page. Overall, mandown serves as a practical tool for anyone wanting a man-page style Markdown viewer in the terminal, with ongoing improvements and customization options.


freq: Efficient Text Frequency Analysis Tool

freq is a command-line tool that analyzes frequency patterns in text data. It improves upon the traditional Unix pipeline sort | uniq -c | sort -rn with more features and better performance. The tool is particularly useful for quick data analysis when you need to understand value distributions in datasets.

You can use regular expressions with freq to extract specific patterns. Without capture groups, it counts matching lines. With one capture group, it counts captured content. With two named groups (n and item), it treats n as the occurrence count of item (this is super helpful for pre-aggregated data).

The tool offers flexible output controls including precision settings, result limits, frequency filters, and various sorting options. You can display results in reverse order, show only unique values, include line numbers or running sums, and hide distribution statistics. Output formats include tab-separated or comma-separated values for compatibility with other tools.

freq automatically handles compressed files, making it convenient for working with archived datasets. Built in Rust, you can install it using cargo with lite, standard, or full feature options depending on your requirements.

Common applications include analyzing word frequencies in text and identifying patterns in log files, such as which IP addresses use the most distinct user agents. Output appears in a table showing counts, percentages, cumulative percentages, and the items themselves.


Biff: A Modern Command Line Tool for DateTime Operations

Biff is a command line tool for working with dates and times. Written in Rust, it handles arithmetic, parsing, formatting, and other datetime operations.

Unlike the traditional Unix date command, Biff doesn’t aim for POSIX compatibility (except for basic timezone handling through the TZ environment variable). Instead, it provides a modern approach to datetime manipulation with features that are often difficult to use in other tools.

BurntSushi (Andrew Gallant of ripgrep fame) developed Biff after frustrations with existing datetime utilities that required constantly referencing manuals due to confusing flags and inconsistent behavior. Biff exposes the capabilities of the Jiff datetime library on the command line, making formatting and arithmetic more straightforward. A super useful feature is the “biff tag” command, which can extract datetimes from any data and format them as JSON lines, enabling complex automated workflows.

Biff can display the current time, format it in various ways (including RFC 3339 and custom formats), perform mathematical operations like adding or subtracting time periods, and generate date sequences based on specific criteria. For example, you can list the next five Mondays at a certain time or show every remaining day in the current month. Advanced features include rounding times to the nearest increment, calculating durations between dates, and reformatting timestamps in log files to your local timezone.

Installation options include precompiled binaries for Windows, macOS, and Linux, with static executables for Linux and Windows. Rust programmers can install using cargo. The tool supports optional locale features for localized datetime formatting through ICU4X integration.


FIN

Remember, you can follow and interact with the full text of The Daily Drop’s free posts on:

  • 🐘 Mastodon via @dailydrop.hrbrmstr.dev@dailydrop.hrbrmstr.dev
  • 🦋 Bluesky via https://bsky.app/profile/dailydrop.hrbrmstr.dev.web.brid.gy

☮️

One response to “Drop #653 (2025-05-15): Command Line Thursday”

  1. Jim Hendrick Avatar

    @dailydrop.hrbrmstr.dev biff looks cool, but I can't help wishing it had been named something different so as not collide with the (historical) UNIX mail tool.

    Like

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.