Linux for Programmers and Users
4.13. Looking at Raw File Contents: od
The octal dump utility, od, allows you to see the contents of a nontext file in a variety of formats. Figure 4-29 describes how it works.
In the following example, I displayed the contents of the "/bin/od" executable as octal numbers, and then as characters: $ od /usr/bin/od ...dump the "/bin/od" file in octal. 0000000 042577 043114 000401 000001 000000 000000 000000 000000 0000020 000002 000003 000001 000000 107020 004004 000064 000000 0000040 101244 000000 000000 000000 000064 000040 000010 000050 0000060 000031 000030 000006 000000 000064 000000 100064 004004 0000100 100064 004004 000400 000000 000400 000000 000005 000000 0000120 000004 000000 000003 000000 000464 000000 100464 004004 0000140 100464 004004 000023 000000 000023 000000 000004 000000 ... $ od -c /usr/bin/od ...dump "/bin/od" as characters. 0000000 177 E L F 001 001 001 \0 \0 \0 \0 \0 \0 \0 \0 \0 0000020 002 \0 003 \0 001 \0 \0 \0 020 216 004 \b 4 \0 \0 \0 0000040 304 202 \0 \0 \0 \0 \0 \0 4 \0 \0 \b \0 ( \0 0000060 031 \0 030 \0 006 \0 \0 \0 4 \0 \0 \0 4 200 004 \b 0000100 4 200 004 \b \0 001 \0 \0 \0 001 \0 \0 005 \0 \0 \0 0000120 004 \0 \0 \0 003 \0 \0 \0 4 001 \0 \0 4 201 004 \b 0000140 4 201 004 \b 023 \0 \0 \0 023 \0 \0 \0 004 \0 \0 \0 ... $ _
You may search for strings of a minimum length by using the -s option. Any series of characters followed by an ASCII null is considered to be a string. $ od -s7 /usr/bin/od ...search for strings 7 chars or more. 0000464 /lib/ld-linux.so.2 0003121 libc.so.6 0003142 putc_unlocked 0003160 getopt_long 0003174 __fpending 0003225 setvbuf 0003235 mbrtowc 0003263 strtoumax 0003312 iswprint ... $ _ |
Категории