[Next] [Previous] [Up] [Top] [Contents]

8.2 File Archiving, Compression and Conversion

8.2.5 od - octal dump of a file

od dumps a file to stdout in different formats, including octal, decimal, floating point, hex, and character format.

Syntax

od [options] file

Common Options

-b octal dump

-d|-D decimal (-d) or long decimal (-D) dump

-s|-S signed decimal (-s) and signed long decimal (-S) dump

-f|-F floating point (-f) or long (double) floating point (-F) dump

-x|-X hex (-x) or long hex (-X) dump

-c|-C character (single byte) or long character dump (single or multi-byte characters, as determined by locale settings) dump

-v verbose mode

Examples

To look at the actual contents of the following file, a list of P. G. Wodehouse's Lord Emsworth novels.

Something Fresh [1915] Uncle Dynamite [1948]

Leave it to Psmith [1923] Pigs Have Wings [1952]

Summer Lightning [1929] Cocktail Time [1958]

Heavy Weather [1933] Service with a Smile [1961]

Blandings Castle and Elsewhere [1935] Galahad at Blandings [1965]

Uncle Fred in the Springtime [1939] A Pelican at Blandings [1969]

Full Moon [1947] Sunset at Blandings [1977]

we could do:

% od -c wodehouse

0000000 S o m e t h i n g F r e s h

0000020 [ 1 9 1 5 ] \t U n c l e D y n

0000040 a m i t e [ 1 9 4 8 ] \n L e a

0000060 v e i t t o P s m i t h

0000100 [ 1 9 2 3 ] \t P i g s H a v e

0000120 W i n g s [ 1 9 5 2 ] \n S u

0000140 m m e r L i g h t n i n g [

0000160 1 9 2 9 ] \t C o c k t a i l T

0000200 i m e [ 1 9 5 8 ] \n H e a v y

0000220 W e a t h e r [ 1 9 3 3 ] \t

0000240 S e r v i c e w i t h a S

0000260 m i l e [ 1 9 6 1 ] \n B l a n

0000300 d i n g s C a s t l e a n d

0000320 E l s e w h e r e [ 1 9 3 5

0000340 ] \t G a l a h a d a t B l a

0000360 n d i n g s [ 1 9 6 5 ] \n U n

0000400 c l e F r e d i n t h e

0000420 S p r i n g t i m e [ 1 9 3 9

0000440 ] \t A P e l i c a n a t B

0000460 l a n d i n g s [ 1 9 6 9 ] \n

0000500 F u l l M o o n [ 1 9 4 7 ]

0000520 \t S u n s e t a t B l a n d

0000540 i n g s [ 1 9 7 7 ] \n

0000554


Introduction to Unix - 14 AUG 1996
[Next] [Previous] [Up] [Top] [Contents]