HEXDUMP(9)

πŸ’– HEXDUMP(9) πŸ’–

okay bestie, welcome to hexdump β€” the kernel developer's manual page that's about to make you obsessed with dumping bytes πŸ’…


✨ NAME ✨

hexdump β€” dump a block of bytes to the console in hexadecimal form πŸ¦‹


🌸 SYNOPSIS 🌸

#include <sys/systm.h>

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

πŸŽ€ DESCRIPTION πŸŽ€

so basically, the hexdump() function prints an array of bytes to the console in hexadecimal form, and it also throws in the ASCII representation of those bytes if it possibly can. like, it's giving ✨full service✨. By default, each line of output will start with an offset count, followed by 16 hexadecimal values, followed by 16 ASCII characters. it's a whole little lineup, no cap πŸ”₯

Now let's meet the parameters, they're all main characters:

  • ptr β€” Pointer to the array of bytes to print. It does not need to be NUL-terminated, so don't stress about that πŸ’–
  • length β€” Number of bytes to print.
  • hdr β€” Pointer to a NUL-terminated character string that will be prepended to each line of output. A value of NULL implies that no header will be printed. (so NULL = no header, she's just not showing up to the party πŸ™ˆ)
  • flags β€” Flags for controlling the formatting of the output. this one has layers, iykyk πŸ’…
    • 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. πŸ“
    • 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. ✨
    • 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.
bestie, note that those three HD_OMIT_* flags are your lil switches for turning off entire columns. use them wisely 🫢

🌈 SEE ALSO 🌈


πŸ‘‘ AUTHORS πŸ‘‘

This manual page was written by Scott Long. iconic behavior, honestly πŸ’œ


and that's the whole page, periodt πŸ’… this Debian version of the HEXDUMP(9) page from the Kernel Developer's Manual is dated December 7, 2003 β€” vintage but still slay βœ¨πŸŽ€πŸ’–

πŸ“¦ where this page comes from