Manpages

HEXDUMP(1) BSD General Commands Manual HEXDUMP(1)

NAME

hexdump — ascii, decimal, hexadecimal, octal dump

사 용 법

hexdump [−bcdovx] [−e format_string] [−f format_file] [−n length] [−s skip] file ...

설 명

풀 그 림 은 지 정 한 파 일 , 또 는 표 준 입 력 으 로 부 터 입 력 된 것 을 사 용 자 가 지 정 한 형 식 으 로 보 여 주 는 연 장 틀 이 다 .

사 용 할 수 있 는 옵 션 은 다 음 과 같 다 :

−b

8진 수 1 바 이 트 씩 보 기 . 입 력 된 파 일 의 내 용 을 세 자 리 씩 한 줄 에 16개 로 나 누 워 8진 수 로 보 여 준 다 .

−c

캐 릭 터 1 바 이 트 씩 보 기 . 입 력 된 파 일 의 내 용 을 세 자 리 씩 한 줄 에 16개 로 나 누 워 문 자 형 식 으 로 보 여 준 다 . 문 자 형 식 이 아 닌 문 자 는 세 자 리 8진 수 로 보 여 준 다 .

−d

10진 수 2 바 이 트 씩 보 기 . 입 력 된 파 일 의 내 용 을 다 섯 자 리 씩 한 줄 에 8개 로 나 누 워 10진 수 로 보 여 준 다 .

−e format_string

보 여 줄 형 식 을 format_string 형 식 으 로 지 정 한 다 .

−f format_file

보 여 줄 형 식 이 하 나 또 는 그 이 상 의 줄 로 나 뉘 어 진 파 일 을 지 정 한 다 . 비 여 있 는 줄 , # 글 자 로 시 작 하 는 줄 은 무 시 된 다 .

−n length

입 력 된 파 일 의 length 바 이 트 만 보 여 준 다 .

−o

8진 수 2 바 이 트 씩 보 기 . 입 력 된 파 일 의 내 용 을 여 섯 자 리 씩 한 줄 에 8개 로 나 누 워 8진 수 로 보 여 준 다 .

−s offset

입 력 파 일 의 처 음 부 터 offset 파 이 트 를 통 과 하 고 보 여 준 다 . offset 사 용 할 숫 자 는 초 기 값 으 로 10진 수 이 며 , 0x0X 로 시 작 하 는 숫 자 는 16진 수 로 처 리 한 다 . 0 으 로 시 작 하 는 숫 자 는 8진 수 . 또 한 숫 자 끝 에 b, k, m 문 자 가 올 수 있 는 데 , 이 것 은 각 각 512, 1024, 1048576 바 이 트 를 의 미 한 다 .

−v

이 옵 션 은 모 든 입 력 자 료 를 보 여 준 다 . 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

16진 수 2바 이 트 씩 보 기 . 입 력 된 파 일 의 내 용 을 4자 리 씩 한 줄 에 8개 로 나 누 워 보 여 준 다 .

각 입 력 파 일 을 위 해 , hexdump 명 령 은 각 각 표 준 출 력 으 로 연 속 적 으 로 복 사 한 다 . 그 리 고 , −e 또 는 −f 옵 션 이 사 용 되 고 있 으 면 , 지 정 한 출 력 양 식 에 따 라 입 력 되 는 자 료 를 변 환 한 다 .

Formats
포 멧 문 자 열 은 공 백 문 자 로 구 분 되 는 여 러 개 의 포 멧 유 닛 을 가 진 다 . 하 나 의 포 멧 유 닛 은 세 부 분 으 로 구 성 된 다 . 반 복 횟 수 , 바 이 트 횟 수 , 포 멧 형 식 이 다 .

반 복 횟 수 는 선 택 적 인 양 수 정 수 이 며 , 초 기 값 은 1이 다 . 각 각 의 포 멧 은 이 횟 수 만 큼 적 용 된 다 .

바 이 트 횟 수 는 선 택 적 인 양 수 정 수 이 며 , 이 값 이 정 해 지 면 , 이 바 이 트 만 큼 변 화 하 면 , 반 복 횟 수 를 읽 어 또 이 바 이 트 만 큼 변 환 한 다 .

반 복 횟 수 와 바 이 트 횟 수 가 둘 다 사 용 되 면 , 슬 래 쉬 (/)로 구 분 한 다 . 슬 래 쉬 앞 뒤 의 어 떠 한 공 백 문 자 도 모 두 무 시 된 다 .

포 멧 은 따 움 표 (" ")로 묶 겨 져 야 한 다 . 포 멧 은 fprintf 함 수 ( fprintf(3)) 에 서 사 용 하 는 것 과 비 슷 하 다 .

* 기 호 는 필 드 넓 이 나 , 정 밀 도 로 사 용 되 지 않 을 수 도 있 다 .

바 이 트 카 운 트 나 필 드 정 밀 도 지 정 에 서 는 ’’s’’ 변 환 문 자 가 필 요 하 다 . (이 것 은 fprintf(3) 함 수 의 사 용 법 과 다 르 다 .)

’’h’’, ’’l’’, ’’n’’, ’’p’’, ’’q’’ 변 환 문 자 는 지 원 되 지 않 는 다 .

다 음 은 C 표 준 에 서 지 원 하 는 \ 문 자 들 이 다 .

NUL \0
<alert character> \a
<backspace> \b
<form-feed> \f
<newline> \n
<carriage return> \r
<tab> \t
<vertical tab> \v

Hexdump에 서 는 부 가 적 으 로 다 음 변 환 문 자 들 도 지 원 한 다 .

_a[dox]

Display the input offset, cumulative across input files, of the next byte to be displayed. The appended characters d, o, and x specify the display base as decimal, octal or hexadecimal respectively.

_A[dox]

Identical to the _a conversion string except that it is only performed once, when all of the input data has been processed.

_c

Output characters in the default character set. Nonprinting characters are displayed in three character, zero-padded octal, except for those representable by standard escape notation (see above), which are displayed as two character strings.

_p

Output characters in the default character set. Nonprinting characters are displayed as a single ’’.’’.

_u

Output US ASCII characters, with the exception that control characters are displayed using the following, lower-case, names. Characters greater than 0xff, hexadecimal, are displayed as hexadecimal strings.

000 nul 001 soh 002 stx 003 etx 004 eot 005 enq
006 ack 007 bel 008 bs 009 ht 00A lf 00B vt
00C ff 00D cr 00E so 00F si 010 dle 011 dc1
012 dc2 013 dc3 014 dc4 015 nak 016 syn 017 etb
018 can 019 em 01A sub 01B esc 01C fs 01D gs
01E rs 01F us 0FF del

The default and supported byte counts for the conversion characters are as follows:

%_c, %_p, %_u, %c

One byte counts only.

%d, %i, %o, %u, %X, %x

Four byte default, one, two and four byte counts supported.

%E, %e, %f, %G, %g

Eight byte default, four byte counts supported.

The amount of data interpreted by each format string is the sum of the data required by each format unit, which is the iteration count times the byte count, or the iteration count times the number of bytes required by the format if the byte count is not specified.

The input is manipulated in ’’blocks’’, where a block is defined as the largest amount of data specified by any format string. Format strings interpreting less than an input block’s worth of data, whose last format unit both interprets some number of bytes and does not have a specified iteration count, have the iteration count incremented until the entire input block has been processed or there is not enough data remaining in the block to satisfy the format string.

If, either as a result of user specification or hexdump modifying the iteration count as described above, an iteration count is greater than one, no trailing whitespace characters are output during the last iteration.

It is an error to specify a byte count as well as multiple conversion characters or strings unless all but one of the conversion characters or strings is _a or _A.

If, as a result of the specification of the −n option or end-of-file being reached, input data only partially satisfies a format string, the input block is zero-padded sufficiently to display all available data (i.e. any format units overlapping the end of data will display some number of the zero bytes).

Further output by such format strings is replaced by an equivalent number of spaces. An equivalent number of spaces is defined as the number of spaces output by an s conversion character with the same field width and precision as the original conversion character or conversion string but with any ’’+’’, ’’ ’’, ’’#’’ conversion flag characters removed, and referencing a NULL string.

If no format strings are specified, the default display is equivalent to specifying the −x option.

hexdump exits 0 on success and >0 if an error occurred.

EXAMPLES

Display the input in perusal format:

"%06.6_ao " 12/1 "%3_u "
"\t\t" "%_p "
"\n"

Implement the −x option:

"%07.7_Ax\n"
"%07.7_ax " 8/2 "%04x " "\n"

관 련 항 목

adb(1)

BSD April 18, 1994 BSD