The fq is a command-line utility designed for inspecting and analyzing binary data. It supports a wide range of binary formats and provides an expressive query language for exploring structured binary content directly from the terminal. This tutorial explains how to install fq binary data analysis tool on Ubuntu 26.04.
Install fq
Obtain the latest fq release version from the GitHub:
FQ_VERSION=$(curl -s "https://api.github.com/repos/wader/fq/releases/latest" | grep -Po '"tag_name": "v\K[0-9.]+')
Download the matching archive and extract the fq executable into /usr/local/bin:
curl -sSL https://github.com/wader/fq/releases/latest/download/fq_${FQ_VERSION}_linux_amd64.tar.gz \
| sudo tar xz -C /usr/local/bin fq
After installation, verify that the fq is correctly available by displaying its version:
fq --version
Testing fq
A JPEG image provides a convenient example for examining binary data. Download a sample image with:
curl -sSo test.jpg https://raw.githubusercontent.com/opencv/opencv/master/samples/data/butterfly.jpg
The JPEG file can then be inspected with an fq expression. The following command extracts the fifth segment (indexing starting from 0) from the image:
fq '.segments[4]' test.jpg
A portion of the resulting output looks similar to this:
The output exposes fields from the JPEG structure, including the marker, image dimensions, and precision. This demonstrates how fq can decode binary formats into readable, queryable data.
Uninstall fq
When fq is no longer needed, remove the installed executable with:
sudo rm -rf /usr/local/bin/fq
Leave a Comment
Cancel reply