XD(1)

πŸ’… XD(1) β€” hex, octal, decimal, or ASCII dump ✨

ok so bestie, listen: yes, this page is literally called xd, and it's from the General Commands Manual. Don't @ me about the name, it's iconic.


πŸŽ€ SYNOPSIS πŸŽ€

xd [ option ... ] [ -format ... ] [ file ... ]

🌸 DESCRIPTION 🌸

So what does xd actually do? It concatenates and dumps the files β€” and if you don't give it any files, it reads standard input, no big deal β€” in one or more formats. Every group of 16 bytes gets printed in each of the named formats, one format per line. Obsessed.

And the way each line of output is prefixed by its address (that's the byte offset in the input file)? Chef's kiss. The first line of output for each group is zero-padded, and the subsequent ones are blank-padded. Asymmetric on purpose, iykyk.


⭐ FORMATS ⭐

Formats other than -c are specified by pairs of characters telling size and style, by default πŸ’«.

πŸ¦‹ The sizes πŸ¦‹

  • 1 or b β€” 1-byte units.
  • 2 or w β€” 2-byte big-endian units.
  • 4 or l β€” 4-byte big-endian units.
  • 8 or v β€” 8-byte big-endian units.

🌈 The styles 🌈

  • o β€” Octal.
  • x β€” Hexadecimal.
  • d β€” Decimal.

πŸ‘‘ OPTIONS πŸ‘‘

Other options are, and I cannot stress enough how much these slayed:

  • -c β€” Format as 1x but print ASCII representations or C escape sequences where possible. Cute and useful.
  • -R β€” Format as 1x but print Rune representations or C escape sequences where possible. Rune girlies rise up 🧚
  • -astyle β€” Print file addresses in the given style (and size 4). Yes, the style is glued right onto the -a. That's just how it is, bestie.
  • -u β€” (Unbuffered) Flush the output buffer after each 16-byte sequence. Impatient queen behavior, valid.
  • -s β€” Reverse (swab) the order of bytes in each group of 4 before printing. Swab it, flip it, reverse it πŸ’…
  • -S β€” Reverse the order of bytes in each group of 8 before printing. Big sister of -s, no cap.
  • -r β€” Print repeating groups of identical 16-byte sequences as the first group followed by an asterisk. Compressed, clean, main character energy ⭐

πŸ’– SOURCE πŸ’–

/src/cmd/xd.c

🫢 SEE ALSO 🫢

  • db(1) β€” go say hi, she's family.

πŸ’€ BUGS πŸ’€

The various output formats don't line up properly in the output of xd. Yeah. That's real. It's giving chaotic, but it's our chaotic. Not a vibe you can fix from the outside, so just… know that going in 😭

and that's the whole page fr fr β€” brought to you by the General Commands Manual, signed, sealed, and delivered as XD(1) at the very bottom, exactly like the original said πŸŽ€βœ¨πŸ¦‹