Install mq Markdown Processing Tool on Ubuntu 26.04

Install mq Markdown Processing Tool on Ubuntu 26.04

The mq is a command-line tool for parsing and querying Markdown documents. It allows headings, lists, links, and other Markdown elements to be extracted using a concise query syntax, making it useful for automation and scripting tasks. Inspired by jq, mq brings a similar query-based approach to Markdown files. This tutorial shows how to install mq Markdown processing tool on Ubuntu 26.04.

Install mq

Download the latest prebuilt mq binary directly from the GitHub releases and save it to /usr/local/bin:

sudo curl -sSLo /usr/local/bin/mq https://github.com/harehare/mq/releases/latest/download/mq-x86_64-unknown-linux-gnu

Grant execute permission to the binary:

sudo chmod a+x /usr/local/bin/mq

Confirm that mq has been installed successfully by displaying its version information:

mq --version

Testing mq

Create a sample Markdown document for testing:

nano test.md

Add the following content:

# My Project

This is a simple Markdown test document.

## Features

Here is the list of features.

Run the following command to extract all headings from the Markdown file:

mq '.h' test.md

Output:

# My Project
## Features

Uninstall mq

If mq is no longer required, remove the installed executable from the system:

sudo rm -rf /usr/local/bin/mq

Leave a Comment

Cancel reply

Your email address will not be published.