{
    "mode": "man",
    "parameter": "HEXDUMP",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/HEXDUMP/1/json",
    "generated": "2026-06-03T04:26:11Z",
    "sections": {
        "NAME": {
            "content": "hexdump - display file contents in hexadecimal, decimal, octal, or ascii\n\nhexdump options file ...\n\nhd options file ...\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The hexdump utility is a filter which displays the specified files, or standard input if no\nfiles are specified, in a user-specified format.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "Below, the length and offset arguments may be followed by the multiplicative suffixes KiB\n(=1024), MiB (=1024*1024), and so on for GiB, TiB, PiB, EiB, ZiB and YiB (the \"iB\" is\noptional, e.g., \"K\" has the same meaning as \"KiB\"), or the suffixes KB (=1000), MB\n(=1000*1000), and so on for GB, TB, PB, EB, ZB and YB.\n",
            "subsections": [
                {
                    "name": "-b --one-byte-octal",
                    "content": "One-byte octal display. Display the input offset in hexadecimal, followed by sixteen\nspace-separated, three-column, zero-filled bytes of input data, in octal, per line.\n",
                    "flag": "-b",
                    "long": "--one-byte-octal"
                },
                {
                    "name": "-c --one-byte-char",
                    "content": "One-byte character display. Display the input offset in hexadecimal, followed by sixteen\nspace-separated, three-column, space-filled characters of input data per line.\n",
                    "flag": "-c",
                    "long": "--one-byte-char"
                },
                {
                    "name": "-C --canonical",
                    "content": "Canonical hex+ASCII display. Display the input offset in hexadecimal, followed by sixteen\nspace-separated, two-column, hexadecimal bytes, followed by the same sixteen bytes in %p\nformat enclosed in '|' characters. Invoking the program as hd implies this option.\n",
                    "flag": "-C",
                    "long": "--canonical"
                },
                {
                    "name": "-d --two-bytes-decimal",
                    "content": "Two-byte decimal display. Display the input offset in hexadecimal, followed by eight\nspace-separated, five-column, zero-filled, two-byte units of input data, in unsigned\ndecimal, per line.\n",
                    "flag": "-d",
                    "long": "--two-bytes-decimal"
                },
                {
                    "name": "-e --format",
                    "content": "Specify a format string to be used for displaying data.\n",
                    "flag": "-e",
                    "long": "--format"
                },
                {
                    "name": "-f --format-file",
                    "content": "Specify a file that contains one or more newline-separated format strings. Empty lines\nand lines whose first non-blank character is a hash mark (#) are ignored.\n",
                    "flag": "-f",
                    "long": "--format-file"
                },
                {
                    "name": "-L --color",
                    "content": "Accept color units for the output. The optional argument when can be auto, never or\nalways. If the when argument is omitted, it defaults to auto. The colors can be disabled;\nfor the current built-in default see the --help output. See also the Colors subsection\nand the COLORS section below.\n",
                    "flag": "-L",
                    "long": "--color"
                },
                {
                    "name": "-n --length",
                    "content": "Interpret only length bytes of input.\n",
                    "flag": "-n",
                    "long": "--length"
                },
                {
                    "name": "-o --two-bytes-octal",
                    "content": "Two-byte octal display. Display the input offset in hexadecimal, followed by eight\nspace-separated, six-column, zero-filled, two-byte quantities of input data, in octal,\nper line.\n",
                    "flag": "-o",
                    "long": "--two-bytes-octal"
                },
                {
                    "name": "-s --skip",
                    "content": "Skip offset bytes from the beginning of the input.\n",
                    "flag": "-s",
                    "long": "--skip"
                },
                {
                    "name": "-v --no-squeezing",
                    "content": "The -v option causes hexdump to display all input data. Without the -v option, any number\nof groups of output lines which would be identical to the immediately preceding group of\noutput lines (except for the input offsets), are replaced with a line comprised of a\nsingle asterisk.\n",
                    "flag": "-v",
                    "long": "--no-squeezing"
                },
                {
                    "name": "-x --two-bytes-hex",
                    "content": "Two-byte hexadecimal display. Display the input offset in hexadecimal, followed by eight\nspace-separated, four-column, zero-filled, two-byte quantities of input data, in\nhexadecimal, per line.\n",
                    "flag": "-x",
                    "long": "--two-bytes-hex"
                },
                {
                    "name": "-V --version",
                    "content": "Display version information and exit.\n",
                    "flag": "-V",
                    "long": "--version"
                },
                {
                    "name": "-h --help",
                    "content": "Display help text and exit.\n\nFor each input file, hexdump sequentially copies the input to standard output, transforming\nthe data according to the format strings specified by the -e and -f options, in the order\nthat they were specified.\n",
                    "flag": "-h",
                    "long": "--help"
                }
            ]
        },
        "FORMATS": {
            "content": "A format string contains any number of format units, separated by whitespace. A format unit\ncontains up to three items: an iteration count, a byte count, and a format.\n\nThe iteration count is an optional positive integer, which defaults to one. Each format is\napplied iteration count times.\n\nThe byte count is an optional positive integer. If specified it defines the number of bytes\nto be interpreted by each iteration of the format.\n\nIf an iteration count and/or a byte count is specified, a single slash must be placed after\nthe iteration count and/or before the byte count to disambiguate them. Any whitespace before\nor after the slash is ignored.\n\nThe format is required and must be surrounded by double quote (\" \") marks. It is interpreted\nas a fprintf-style format string (see fprintf(3), with the following exceptions:\n\n1.\nAn asterisk (*) may not be used as a field width or precision.\n\n2.\nA byte count or field precision is required for each s conversion character (unlike the\nfprintf3 default which prints the entire string if the precision is unspecified).\n\n3.\nThe conversion characters h, l, n, p, and q are not supported.\n\n4.\nThe single character escape sequences described in the C standard are supported:\n\n┌──────────────────┬────┐\n│                  │    │\n│NULL              │ \\0 │\n├──────────────────┼────┤\n│                  │    │\n│<alert character> │ \\a │\n├──────────────────┼────┤\n│                  │    │\n│<backspace>       │ \\b │\n├──────────────────┼────┤\n│                  │    │\n│<form-feed>       │ \\f │\n├──────────────────┼────┤\n│                  │    │\n│<newline>         │ \\n │\n├──────────────────┼────┤\n│                  │    │\n│<carriage return> │ \\r │\n├──────────────────┼────┤\n│                  │    │\n│<tab>             │ \\t │\n├──────────────────┼────┤\n│                  │    │\n│<vertical tab>    │ \\v │\n└──────────────────┴────┘\n",
            "subsections": [
                {
                    "name": "Conversion strings",
                    "content": "The hexdump utility also supports the following additional conversion strings.\n\na[dox]\nDisplay the input offset, cumulative across input files, of the next byte to be\ndisplayed. The appended characters d, o, and x specify the display base as decimal,\noctal or hexadecimal respectively.\n\nA[dox]\nIdentical to the a conversion string except that it is only performed once, when\nall of the input data has been processed.\n\nc\nOutput characters in the default character set. Non-printing characters are\ndisplayed in three-character, zero-padded octal, except for those representable by\nstandard escape notation (see above), which are displayed as two-character strings.\n\np\nOutput characters in the default character set. Non-printing characters are\ndisplayed as a single '.'.\n\nu\nOutput US ASCII characters, with the exception that control characters are\ndisplayed using the following, lower-case, names. Characters greater than 0xff,\nhexadecimal, are displayed as hexadecimal strings.\n\n┌────────┬─────────┬─────────┬─────────┬─────────┬─────────┐\n│        │         │         │         │         │         │\n│000 nul │ 001 soh │ 002 stx │ 003 etx │ 004 eot │ 005 enq │\n├────────┼─────────┼─────────┼─────────┼─────────┼─────────┤\n│        │         │         │         │         │         │\n│006 ack │ 007 bel │ 008 bs  │ 009 ht  │ 00A lf  │ 00B vt  │\n├────────┼─────────┼─────────┼─────────┼─────────┼─────────┤\n│        │         │         │         │         │         │\n│00C ff  │ 00D cr  │ 00E so  │ 00F si  │ 010 dle │ 011 dc1 │\n├────────┼─────────┼─────────┼─────────┼─────────┼─────────┤\n│        │         │         │         │         │         │\n│012 dc2 │ 013 dc3 │ 014 dc4 │ 015 nak │ 016 syn │ 017 etb │\n├────────┼─────────┼─────────┼─────────┼─────────┼─────────┤\n│        │         │         │         │         │         │\n│018 can │ 019 em  │ 01A sub │ 01B esc │ 01C fs  │ 01D gs  │\n├────────┼─────────┼─────────┼─────────┼─────────┼─────────┤\n│        │         │         │         │         │         │\n│01E rs  │ 01F us  │ 0FF del │         │         │         │\n└────────┴─────────┴─────────┴─────────┴─────────┴─────────┘\n"
                },
                {
                    "name": "Colors",
                    "content": "When put at the end of a format specifier, hexdump highlights the respective\nstring with the color specified. Conditions, if present, are evaluated prior to\nhighlighting.\n\nL[colorunit1,colorunit2,...,colorunitn]\n\nThe full syntax of a color unit is as follows:\n\n[!]COLOR[:VALUE][@OFFSETSTART[-END]]\n\n!\nNegate the condition. Please note that it only makes sense to negate a unit\nif both a value/string and an offset are specified. In that case the\nrespective output string will be highlighted if and only if the value/string\ndoes not match the one at the offset.\n\nCOLOR\nOne of the 8 basic shell colors.\n\nVALUE\nA value to be matched specified in hexadecimal, or octal base, or as a\nstring. Please note that the usual C escape sequences are not interpreted by\nhexdump inside the colorunits.\n\nOFFSET\nAn offset or an offset range at which to check for a match. Please note that\nlone OFFSETSTART uses the same value as END offset.\n"
                },
                {
                    "name": "Counters",
                    "content": "The default and supported byte counts for the conversion characters are as\nfollows:\n\n%c, %p, %u, %c\nOne byte counts only.\n\n%d, %i, %o, %u, %X, %x\nFour byte default, one, two and four byte counts supported.\n\n%E, %e, %f, %G, %g\nEight byte default, four byte counts supported.\n\nThe amount of data interpreted by each format string is the sum of the data\nrequired by each format unit, which is the iteration count times the byte count,\nor the iteration count times the number of bytes required by the format if the\nbyte count is not specified.\n\nThe input is manipulated in blocks, where a block is defined as the largest\namount of data specified by any format string. Format strings interpreting less\nthan an input block’s worth of data, whose last format unit both interprets some\nnumber of bytes and does not have a specified iteration count, have the iteration\ncount incremented until the entire input block has been processed or there is not\nenough data remaining in the block to satisfy the format string.\n\nIf, either as a result of user specification or hexdump modifying the iteration\ncount as described above, an iteration count is greater than one, no trailing\nwhitespace characters are output during the last iteration.\n\nIt is an error to specify a byte count as well as multiple conversion characters\nor strings unless all but one of the conversion characters or strings is a or\nA.\n\nIf, as a result of the specification of the -n option or end-of-file being\nreached, input data only partially satisfies a format string, the input block is\nzero-padded sufficiently to display all available data (i.e., any format units\noverlapping the end of data will display some number of the zero bytes).\n\nFurther output by such format strings is replaced by an equivalent number of\nspaces. An equivalent number of spaces is defined as the number of spaces output\nby an s conversion character with the same field width and precision as the\noriginal conversion character or conversion string but with any '+', ' ', '#'\nconversion flag characters removed, and referencing a NULL string.\n\nIf no format strings are specified, the default display is very similar to the -x\noutput format (the -x option causes more space to be used between format units\nthan in the default output).\n"
                }
            ]
        },
        "EXIT STATUS": {
            "content": "hexdump exits 0 on success and > 0 if an error occurred.\n",
            "subsections": []
        },
        "CONFORMING TO": {
            "content": "The hexdump utility is expected to be IEEE Std 1003.2 (\"POSIX.2\") compatible.\n",
            "subsections": []
        },
        "EXAMPLES": {
            "content": "Display the input in perusal format:\n\n\"%06.6ao \"  12/1 \"%3u \"\n\"\\t\" \"%p \"\n\"\\n\"\n\nImplement the -x option:\n\n\"%07.7Ax\\n\"\n\"%07.7ax  \" 8/2 \"%04x \" \"\\n\"\n\nMBR Boot Signature example: Highlight the addresses cyan and the bytes at offsets\n510 and 511 green if their value is 0xAA55, red otherwise.\n\n\"%07.7AxL[cyan]\\n\"\n\"%07.7axL[cyan]  \" 8/2 \"   %04xL[green:0xAA55@510-511,!red:0xAA55@510-511] \" \"\\n\"\n",
            "subsections": []
        },
        "COLORS": {
            "content": "Implicit coloring can be disabled by an empty file\n/etc/terminal-colors.d/hexdump.disable.\n\nSee terminal-colors.d(5) for more details about colorization configuration.\n",
            "subsections": []
        },
        "REPORTING BUGS": {
            "content": "For bug reports, use the issue tracker at\nhttps://github.com/karelzak/util-linux/issues.\n",
            "subsections": []
        },
        "AVAILABILITY": {
            "content": "The hexdump command is part of the util-linux package which can be downloaded\nfrom Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>.\n\n\n\nutil-linux 2.37.2                            2021-06-02                                   HEXDUMP(1)",
            "subsections": []
        }
    },
    "summary": "hexdump - display file contents in hexadecimal, decimal, octal, or ascii  hexdump options file ...  hd options file ...",
    "flags": [
        {
            "flag": "-b",
            "long": "--one-byte-octal",
            "arg": null,
            "description": "One-byte octal display. Display the input offset in hexadecimal, followed by sixteen space-separated, three-column, zero-filled bytes of input data, in octal, per line."
        },
        {
            "flag": "-c",
            "long": "--one-byte-char",
            "arg": null,
            "description": "One-byte character display. Display the input offset in hexadecimal, followed by sixteen space-separated, three-column, space-filled characters of input data per line."
        },
        {
            "flag": "-C",
            "long": "--canonical",
            "arg": null,
            "description": "Canonical hex+ASCII display. Display the input offset in hexadecimal, followed by sixteen space-separated, two-column, hexadecimal bytes, followed by the same sixteen bytes in %p format enclosed in '|' characters. Invoking the program as hd implies this option."
        },
        {
            "flag": "-d",
            "long": "--two-bytes-decimal",
            "arg": null,
            "description": "Two-byte decimal display. Display the input offset in hexadecimal, followed by eight space-separated, five-column, zero-filled, two-byte units of input data, in unsigned decimal, per line."
        },
        {
            "flag": "-e",
            "long": "--format",
            "arg": null,
            "description": "Specify a format string to be used for displaying data."
        },
        {
            "flag": "-f",
            "long": "--format-file",
            "arg": null,
            "description": "Specify a file that contains one or more newline-separated format strings. Empty lines and lines whose first non-blank character is a hash mark (#) are ignored."
        },
        {
            "flag": "-L",
            "long": "--color",
            "arg": null,
            "description": "Accept color units for the output. The optional argument when can be auto, never or always. If the when argument is omitted, it defaults to auto. The colors can be disabled; for the current built-in default see the --help output. See also the Colors subsection and the COLORS section below."
        },
        {
            "flag": "-n",
            "long": "--length",
            "arg": null,
            "description": "Interpret only length bytes of input."
        },
        {
            "flag": "-o",
            "long": "--two-bytes-octal",
            "arg": null,
            "description": "Two-byte octal display. Display the input offset in hexadecimal, followed by eight space-separated, six-column, zero-filled, two-byte quantities of input data, in octal, per line."
        },
        {
            "flag": "-s",
            "long": "--skip",
            "arg": null,
            "description": "Skip offset bytes from the beginning of the input."
        },
        {
            "flag": "-v",
            "long": "--no-squeezing",
            "arg": null,
            "description": "The -v option causes hexdump to display all input data. Without the -v option, any number of groups of output lines which would be identical to the immediately preceding group of output lines (except for the input offsets), are replaced with a line comprised of a single asterisk."
        },
        {
            "flag": "-x",
            "long": "--two-bytes-hex",
            "arg": null,
            "description": "Two-byte hexadecimal display. Display the input offset in hexadecimal, followed by eight space-separated, four-column, zero-filled, two-byte quantities of input data, in hexadecimal, per line."
        },
        {
            "flag": "-V",
            "long": "--version",
            "arg": null,
            "description": "Display version information and exit."
        },
        {
            "flag": "-h",
            "long": "--help",
            "arg": null,
            "description": "Display help text and exit. For each input file, hexdump sequentially copies the input to standard output, transforming the data according to the format strings specified by the -e and -f options, in the order that they were specified."
        }
    ],
    "examples": [
        "Display the input in perusal format:",
        "\"%06.6ao \"  12/1 \"%3u \"",
        "\"\\t\" \"%p \"",
        "\"\\n\"",
        "Implement the -x option:",
        "\"%07.7Ax\\n\"",
        "\"%07.7ax  \" 8/2 \"%04x \" \"\\n\"",
        "MBR Boot Signature example: Highlight the addresses cyan and the bytes at offsets",
        "510 and 511 green if their value is 0xAA55, red otherwise.",
        "\"%07.7AxL[cyan]\\n\"",
        "\"%07.7axL[cyan]  \" 8/2 \"   %04xL[green:0xAA55@510-511,!red:0xAA55@510-511] \" \"\\n\""
    ],
    "see_also": []
}