HEXDUMP(9)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1, nixpkgs unstable

πŸ’… NAME

okay so bestie, this is HEXDUMP(9) β€” the kernel developer manual page for hexdump, and its whole thing is dumping a block of bytes to the console in hexadecimal form. ✨ literally the glow-up inspector for raw bytes.


✨ SYNOPSIS

#include <sys/systm.h>

void
hexdump(void *ptr, int length, const char *hdr, int flags);

πŸŽ€ DESCRIPTION

The hexdump() function prints an array of bytes to the console in hexadecimal form, along with the ASCII representation of those bytes, if possible. no cap, it's giving β€œshow me the vibes of this memory.” 🌸

By default, each line of output starts with an offset count, followed by 16 hexadecimal values, followed by 16 ASCII characters. iconic formatting behavior, honestly. 🫢

  • ptr β€” pointer to the array of bytes to print. it does not need to be NUL-terminated, bestie. it's just bytes. raw. unfiltered. πŸ’…
  • length β€” number of bytes to print.
  • hdr β€” pointer to a NUL-terminated character string that gets prepended to each line of output. a value of NULL implies that no header will be printed. so if you want no header energy, NULL is your girl. πŸ™ˆ
  • flags β€” flags for controlling the formatting of the output. this is where it gets cute and specific:
    • Bits 0-7 β€” integer value of the number of bytes to display on each line. a value of 0 implies that the default value of 16 will be used. so 0 doesn't mean zero bytes, it means β€œbestie, use the default.” πŸ’–
    • Bits 8-15 β€” character ASCII value to use as the separator for the hexadecimal output. a value of 0 implies that the default value of 32 (ASCII space) will be used. yes, that's the space character. slay. πŸ”₯
    • HD_OMIT_COUNT β€” do not print the offset column at the beginning of each line.
    • HD_OMIT_HEX β€” do not print the hexadecimal values on each line.
    • HD_OMIT_CHARS β€” do not print the character values on each line.
lowkey important: these are flags, not suggestions. the kernel is gonna format exactly what you ask for. πŸ‘‘

🌈 SEE ALSO


πŸ‘‘ AUTHORS

This manual page was written by Scott Long. periodt. πŸ’œ


okay bye bestie β€” this one's from the Debian manual, dated December 7, 2003, and it was HEXDUMP(9) the whole time πŸ«ΆπŸ’–

πŸ“¦ where this page comes from