LinuxCommandLibrary

hexyl

Display file contents in hexadecimal format

TLDR

Print the hexadecimal representation of a file

$ hexyl [path/to/file]
copy

Print the hexadecimal representation of the first n bytes of a file
$ hexyl [[-n|--length]] [n] [path/to/file]
copy

Print bytes 512 through 1024 of a file
$ hexyl -r [512]:[1024] [path/to/file]
copy

Print 512 bytes starting at the 1024th byte
$ hexyl -r [1024]:+[512] [path/to/file]
copy

SYNOPSIS

hexyl [OPTIONS] [FILE...]

PARAMETERS

-n, --length <NUM>
    Limits the output to the first NUM bytes of the input file(s). This is useful for quickly inspecting the beginning of large files.

-o, --offset <NUM>
    Starts reading from NUM bytes into the file. This allows you to skip a specific number of bytes from the beginning and view content from a particular offset.

-s, --color-scheme <SCHEME>
    Specifies the color scheme for the output. Available schemes typically include 'dark' and 'light', optimizing readability based on your terminal background.

--no-color
    Disables all colored output. The bytes will be displayed in plain terminal colors, which can be useful for terminals that don't support true color or for scripting purposes.

--raw
    Outputs only the raw hexadecimal bytes and their ASCII/UTF-8 representation, without the address column or vertical separators. This provides a more compact view.

--endianness <ENDIANNESS>
    Displays data with the specified endianness. Options are 'little' or 'big'. The default is typically 'big-endian'.

--no-pretty
    Disables pretty printing, which means byte groups (e.g., 2 bytes) are not separated by spaces. This results in a more compact, continuous hex stream.

DESCRIPTION

hexyl is a powerful command-line utility for viewing and inspecting binary files in hexadecimal format. It aims to be a modern, user-friendly alternative to traditional tools like hexdump and xxd, offering enhanced readability through intelligent colorized output and an intuitive interface. hexyl displays bytes in hexadecimal on the left, an ASCII/UTF-8 representation on the right, and provides an offset column in the middle. Its key features include intelligent colorization to highlight different byte types (e.g., printable ASCII, non-printable, null bytes), efficient handling of large files, and a responsive experience. It's particularly useful for debugging, reverse engineering, and low-level file analysis where understanding byte-level data is crucial. Unlike simple hex dumps, hexyl's visual cues help quickly identify patterns and anomalies in binary data.

CAVEATS

hexyl is primarily a hex viewer, not an editor; it cannot modify files directly. While efficient, very large files might still lead to higher memory usage depending on internal buffering. Its rich color output requires a terminal that supports true colors for the best visual experience.

INTELLIGENT COLORIZATION

One of hexyl's most significant features is its sophisticated colorization scheme. It automatically assigns different colors to various byte types, such as printable ASCII characters, non-printable control characters, null bytes, whitespace, and invalid UTF-8 sequences. This visual distinction dramatically improves the readability of binary data and helps in quickly identifying specific data patterns or anomalies within a file.

PERFORMANCE AND EFFICIENCY

Written in Rust, hexyl is designed with performance in mind. It handles large files efficiently, offering a responsive user experience even when dealing with gigabytes of binary data. Its optimized parsing and rendering routines ensure quick display of hex dumps without significant lag, making it suitable for professional analysis workflows.

HISTORY

hexyl was created by Daniel P. Schroeder (@sharkdp), a prominent developer known for several highly-regarded command-line tools written in Rust (e.g., fd, bat). It emerged around 2018 as a modern, visually superior alternative to traditional hex viewing utilities like hexdump and xxd, addressing their often verbose and less readable output. Its development focused on providing intelligent default behaviors and a highly performant, user-friendly experience.

SEE ALSO

hexdump(1), xxd(1), od(1), less(1)

Copied to clipboard