HEXYL(1)

✨ hexyl(1) β€” the terminal hex viewer that ATE πŸ’…

okay bestie, so you know how sometimes you need to peek inside a file and see what's actually going on byte-by-byte? that's literally what hexyl does, and it's the manual page for it, and we're gonna get through it together. it's a command-line hex viewer (the NAME section said it, i'm just saying it louder πŸ’–). no cap, this is the glow-up version of staring at raw bytes.


🌸 SYNOPSIS 🌸

hexyl [OPTIONS] [FILE]

that's the whole vibe. options and maybe a file, that's it. slay.


πŸ¦‹ DESCRIPTION πŸ¦‹

hexyl is a simple hex viewer for the terminal. it uses colored output to tell apart different categories of bytes β€” and yes, the color-coding is the whole main character energy here:

  • NULL bytes
  • printable ASCII characters
  • ASCII whitespace characters
  • other ASCII characters
  • non-ASCII (the fancy ones πŸ’…)

it's giving "i can read hex now" and honestly? iconic.


πŸŽ€ POSITIONAL ARGUMENTS πŸŽ€

  • FILE β€” the file you wanna display. if you don't give a FILE argument at all, it just reads from STDIN (so you can pipe stuff in, we love a flexible queen 🫢).

✨ OPTIONS ✨

get comfy, there's a bunch, but every single one is here, i promise.

  • -n, --length N β€” only read N bytes from the input. and bestie, N is flexible: it can include a unit with a decimal prefix (kB, MB, ..) or a binary prefix (kiB, MiB, ..), or you can give it as a hex number. so many ways to say "just this much" 😌

Examples:

Read the first 64 bytes:

$ hexyl --length=64

Read the first 4 kibibytes:

$ hexyl --length=4KiB

Read the first 255 bytes (specified using a hex number):

$ hexyl --length=0xff
  • -c, --bytes N β€” literally just an alias for -n/--length. same energy, different letter.
  • -l N β€” yet another alias for -n/--length. three names, one job, she's versatile πŸ’β€β™€οΈ
  • -s, --skip N β€” skip the first N bytes of the input. N can include a unit too (peep --length for the deets). and plot twist: a negative value is valid and will seek from the end of the file. working backwards, we stan 😭
  • --block-size SIZE β€” sets the size of the block unit to SIZE (default is 512). this is for when you're measuring in "blocks" and need to define how big a block is.

Examples:

Sets the block size to 1024 bytes:

$ hexyl --block-size=1024 --length=5block

Sets the block size to 4 kilobytes:

$ hexyl --block-size=4kB --length=2block
  • -v, --no-squeezing β€” displays all input data. otherwise, any number of groups of output lines that would be identical to the preceding group of lines gets replaced with a line that's just a single asterisk (*). so it's squeezing out the repeats unless you say no πŸ’€
  • --color WHEN β€” when to use colors. auto-mode only displays colors if the output goes to an interactive terminal (so it knows when to flex and when to chill).

Possible values:

  • always (default)
  • auto
  • never
  • --border STYLE β€” whether to draw a border with Unicode characters, ASCII characters, or none at all. pick your aesthetic 🎨

Possible values:

  • unicode (default)
  • ascii
  • none
  • -o, --display-offset N β€” add N bytes to the displayed file position. N can include a unit (again, see --length). a negative value is valid and calculates an offset relative to the end of the file. offsets going both ways, she's fluid 🌊
  • -h, --help β€” prints help information. the classic "help me help you" move.
  • -V, --version β€” prints version information. for when you gotta know which hexyl you're dealing with πŸ‘‘

πŸ’œ ENVIRONMENT VARIABLES πŸ’œ

bestie. you can customize hexyl's colors via environment variables and it is so much fun. the variables used are as follows:

  • HEXYL_COLOR_ASCII_PRINTABLE: any non-whitespace printable ASCII character
  • HEXYL_COLOR_ASCII_WHITESPACE: whitespace such as space or newline (only visible in middle panel with byte values)
  • HEXYL_COLOR_ASCII_OTHER: any other ASCII character (< 0x80) besides null
  • HEXYL_COLOR_NULL: the null byte (0x00)
  • HEXYL_COLOR_NONASCII: any non-ASCII byte (> 0x7F)
  • HEXYL_COLOR_OFFSET: the lefthand file offset

the colors can be any of the 8 standard terminal colors: black, blue, cyan, green, magenta, red, yellow and white. the "bright" variants are also supported (e.g., bright blue). and if you're feeling extra, you can use the RGB hex format, #abcdef. like, for example:

HEXYL_COLOR_ASCII_PRINTABLE=blue HEXYL_COLOR_ASCII_WHITESPACE="bright green" HEXYL_COLOR_ASCII_OTHER="#ff7f99"

look at that palette. a whole aesthetic. 🌈


πŸ”₯ NOTES πŸ”₯

Source repository:

https://github.com/sharkdp/hexyl

(the plug is necessary, iykyk)


πŸ“ EXAMPLES πŸ“

Print a given file:

$ hexyl small.png

Print and view a given file in the terminal pager:

$ hexyl big.png | less -r

Print the first 256 bytes of a given special file:

$ hexyl -n 256 /dev/urandom

three examples, all iconic, no notes. ✨


πŸ‘‘ AUTHORS πŸ‘‘

hexyl was written by David Peter mail@david-peter.de. shoutout to the author, main character energy fr fr.


πŸ™ˆ REPORTING BUGS πŸ™ˆ

Bugs can be reported on GitHub at:

https://github.com/sharkdp/hexyl/issues

found a bug? don't be shy, report it, we love a proactive bestie 🫢


hexyl is dual-licensed under:

dual-licensed? versatile, generous, we love to see it.


⭐ SEE ALSO ⭐

hexdump(1), xxd(1)

(go check those out too, the whole hex-viewer friend group is here)


okay that's the whole page, bestie. and for the sign-off: this is hexyl 0.12.0, dated 2022-12-05. go peek at some bytes, you're gonna slay πŸ’–πŸŒΈπŸ¦‹

πŸ“¦ where this page comes from