サーバーのよく使うコマンドメモ| hexdump

Summery
ファイルの情報を16進数などで表示する
Construction
1 |
$hexdump [option] [file] |
Option
-C : アスキー文字列の表示
-n : 指定バイト数のみ表示
Sample
1 2 |
# png画像のバイナリ表示(アスキー文字列) hexdump -C hoge.png |
Discription
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
HEXDUMP(1) BSD General Commands Manual HEXDUMP(1) NAME hexdump -- ASCII, decimal, hexadecimal, octal dump SYNOPSIS hexdump [-bcCdovx] [-e format_string] [-f format_file] [-n length] [-s skip] file ... DESCRIPTION The hexdump utility is a filter which displays the specified files, or the standard input, if no files are specified, in a user specified format. The options are as follows: -b 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. -C Canonical hex+ASCII display. Display the input offset in hexadeci- mal, followed by sixteen space-separated, two column, hexadecimal bytes, followed by the same sixteen bytes in %_p format enclosed in ``|'' characters. -c One-byte character display. Display the input offset in hexadeci- mal, followed by sixteen space-separated, three column, space- filled, characters of input data per line. -d 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. -e format_string Specify a format string to be used for displaying data. -f format_file 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. -n length Interpret only length bytes of input. -o 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. -s offset Skip offset bytes from the beginning of the input. By default, offset is interpreted as a decimal number. With a leading 0x or 0X, offset is interpreted as a hexadecimal number, otherwise, with a leading 0, offset is interpreted as an octal number. Appending the character b, k, m, or g to offset causes it to be interpreted as a multiple of 512, 1024, 1048576, or 1073741824, respectively. -v Cause 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. -x Two-byte hexadecimal display. Display the input offset in hexadec- imal, followed by eight, space separated, four column, zero-filled, two-byte quantities of input data, in hexadecimal, per line. For each input file, hexdump sequentially copies the input to standard out- put, transforming the data according to the format strings specified by the -e and -f options, in the order that they were specified. Formats A format string contains any number of format units, separated by white- space. A format unit contains up to three items: an iteration count, a byte count, and a format. The iteration count is an optional positive integer, which defaults to one. Each format is applied iteration count times. The byte count is an optional positive integer. If specified it defines the number of bytes to be interpreted by each iteration of the format. If an iteration count and/or a byte count is specified, a single slash must be placed after the iteration count and/or before the byte count to disam- biguate them. Any whitespace before or after the slash is ignored. The format is required and must be surrounded by double quote (" ") marks. It is interpreted as a fprintf-style format string (see fprintf(3)), with the following exceptions: o An asterisk (*) may not be used as a field width or precision. o A byte count or field precision is required for each ``s'' con- version character (unlike the fprintf(3) default which prints the entire string if the precision is unspecified). o The conversion characters ``h'', ``l'', ``n'', ``p'' and ``q'' are not supported. o The single character escape sequences described in the C standard are supported: NUL |