function Description:Output file contents.
Syntax:od [-abcdfhilovx][-a < Loadline cardinality >][-j < characters >][-n < number of characters >][-s < string characters >][-t < output format >][-w < number of characters per column >][--help][--version][file ...]
Additional notes:The OD instruction reads the contents of the given file and renders its contents in octal loadline.
Parameters:
-a The effect of this parameter is the same as specifying the "-ta" parameter.
-a< Loadline Cardinality > select the cardinality to calculate loadline.
-B The effect of this parameter is the same as specifying the "-TOC" parameter.
-C This parameter has the same effect as specifying the "-TC" parameter.
-d The effect of this parameter is the same as specifying the "-TU2" parameter.
-F The effect of this parameter is the same as specifying the "-TFF" parameter.
-H This parameter has the same effect as specifying the "-TX2" parameter.
-I the effect of this parameter is the same as specifying the "-TD2" parameter.
-j< number of characters > or--skip-bytes=< characters > skip setting the number of characters.
-L The effect of this parameter is the same as specifying the "-TD4" parameter.
-n< number of characters > or--read-bytes=< characters > until the number of characters set.
-O This parameter has the same effect as specifying the "-to2" parameter.
-s< string character count > or--strings=< string character > displays only strings that match the specified number of characters.
-t< output format > or--format=< output format > Set output format.
-V or--output-duplicates output without omitting duplicate data.
-w< number of characters per column > or--width=< per column character > sets the maximum number of characters per column.
-X The effect of this parameter is the same as specifying the "-H" parameter.
--help online Help.
--version Displays version information.
Instance
123 |
[[email protected] ~]$ echo abcdef g > tmp [[email protected] ~]$ cat tmp abcdef g |
Description: Prepare a TMP file first
123 |
[[email protected] ~]$ od -b tmp 0000000 141 142 143 144 145 146 040 147 012 0000011 |
Description: Use a single-byte octal interpretation for output, noting that the default address format on the left is eight bytes
123 |
[[email protected] ~]$ od -c tmp 0000000 a b c d e f g \n 0000011 |
Description: Use ASCII code for output, note that includes escape characters
123 |
[[email protected] ~]$ od -t d1 tmp 0000000 97 98 99 100 101 102 32 103 10 0000011 |
Description: Use single-byte decimal for interpretation
123 |
[[email protected] ~]$ od -A d -c tmp 0000000 a b c d e f g \n 0000009 |
Description: Sets the address format to decimal.
123 |
[[email protected] ~]$ od -A x -c tmp 000000 a b c d e f g \n 000009 |
Description: Set the address format to hexadecimal
123 |
[[email protected] ~]$ od -j 2 -c tmp 0000002 c d e f g \n 0000011 |
Description: Skips the start of the two bytes
123 |
[[email protected] ~]$ od -N 2 -j 2 -c tmp 0000002 c d 0000004 |
Description: Skips the start of two bytes and outputs only two bytes
1234567891011 |
[[email protected] ~]$ od -w1 -c tmp 0000000 a 0000001 b 0000002 c 0000003 d 0000004 e 0000005 f 0000006 0000007 g 0000010 \n 0000011 |
Description: Output only 1 bytes per line
1234567 |
[[email protected] ~]$ od -w2 -c tmp 0000000 a b 0000002 c d 0000004 e f 0000006 g 0000010 \n 0000011 |
Description: Output of two bytes per line
12345 |
[[email protected] ~]$ od -w3 -b tmp 0000000 141 142 143 0000003 144 145 146 0000006 040 147 012 0000011 |
Description: Outputs 3 bytes per line and is interpreted using octal single byte
Linux OD command detailed