Skip to content

Linux xxd Guide

Mattscreative edited this page Dec 5, 2025 · 2 revisions

Linux xxd Guide

Complete beginner-friendly guide to xxd on Linux, covering Arch Linux, CachyOS, and other distributions including hex dump, binary file editing, and data conversion.


Table of Contents

  1. xxd Installation
  2. xxd Basics
  3. Hex Dump
  4. Reverse Operation
  5. Troubleshooting

xxd Installation

Install xxd

Arch/CachyOS:

# Install vim (includes xxd)
sudo pacman -S vim

Debian/Ubuntu:

sudo apt install vim

Fedora:

sudo dnf install vim

xxd Basics

Hex Dump

Basic usage:

# Hexadecimal dump
xxd file.txt

# Shows file in hex format

Reverse

Convert back:

# Convert hex back to binary
xxd -r hex.txt > output.bin

# -r = reverse (converts hex to binary)

Hex Dump

Default Format

Hex output:

# Default hex format
xxd file.txt

# Shows:
# - Offset (hex)
# - Hexadecimal bytes (16 per line)
# - ASCII representation

Limit Length

Limit output:

# Limit length
xxd -l 100 file.txt

# -l = length (first 100 bytes)

Reverse Operation

Hex to Binary

Convert hex:

# Convert hex dump to binary
xxd -r hex.txt > output.bin

# -r = reverse (hex to binary)

Plain Hex

Plain format:

# Plain hex (no ASCII)
xxd -p file.txt

# -p = plain (hex only, no offset)

Troubleshooting

xxd Not Found

Check installation:

# Check xxd
which xxd

# Install vim if missing
sudo pacman -S vim

Summary

This guide covered xxd usage, hex dump, and binary file conversion for Arch Linux, CachyOS, and other distributions.


Next Steps


This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.

Clone this wiki locally