5
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

linux > ファイルのバイナリ表示(ASCII文字) > od -Ax -tx1z [ファイル]

Last updated at Posted at 2015-03-18

動作確認

CentOS 6.5

一部ASCII文字が含まれるファイルでASCII文字を見たい。

バイナリファイルで一部ASCII文字が含まれる場合、以下のようにすることで、ASCII文字を見ることができる。

~~```
$od -tc sample.elf | less
0000000 177 E L F 001 001 001 \0 \0 \0 \0 \0 \0 \0 \0 \0
0000020 002 \0 ( \0 001 \0 \0 \0 \0 \0 \0 \0 4 \0 \0 \0
...


~~上記の例では"ELF"という文字を見ることができる。~~

<hr>
(追記 2015/03/18)
lainzeroさんに教えていただいた方法が見やすい。

$od -Ax -tx1z sample.elf
000000 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 >.ELF............<
000010 02 00 28 00 01 00 00 00 00 00 00 00 34 00 00 00 >..(.........4...<
000020 0c 60 03 00 00 02 00 05 34 00 20 00 02 00 28 00 >.`......4. ...(.<
000030 1b 00 18 00 01 00 00 00 00 80 00 00 00 00 00 00 >................<
...

こちらの場合ASCII文字列が連続で表示されるので、例えば"ELF"で検索ができる。

5
7
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?