Share to: share facebook share twitter share wa share telegram print page

 

Od (Unix)

od
Original author(s)AT&T Bell Laboratories
Developer(s)Various open-source and commercial developers
Initial releaseNovember 3, 1971; 53 years ago (1971-11-03)
Operating systemUnix, Unix-like, IBM i
PlatformCross-platform
TypeCommand
Licensecoreutils: GPLv3+

od is a command on various operating systems for displaying ("dumping") data in various human-readable output formats. The name is an acronym for "octal dump" since it defaults to printing in the octal data format.

Overview

The od program can display output in a variety of formats, including octal, hexadecimal, decimal, and ASCII. It is useful for visualizing data that is not in a human-readable format, like the executable code of a program, or where the primary form is ambiguous (e.g. some Latin, Greek and Cyrillic characters looking similar).

od is one of the earliest Unix programs, having appeared in version 1 AT&T Unix. It is also specified in the POSIX standards. The implementation for od used on Linux systems is usually provided by GNU Core Utilities.

Since it predates the Bourne shell, its existence causes an inconsistency in the do loop syntax. Other loops and logical blocks are opened by the name, and closed by the reversed name, e.g. if ... fi and case ... esac, but od's existence necessitates do ... done.

The command is available as a separate package for Microsoft Windows as part of the UnxUtils collection of native Win32 ports of common GNU Unix-like utilities.[1] The od command has also been ported to the IBM i operating system.[2]

Example session

Normally a dump of an executable file is very long. The head program prints out the first few lines of the output. Here is an example of a dump of the "Hello world" program, piped through head.

% od hello | head
0000000 042577 043114 000401 000001 000000 000000 000000 000000
0000020 000002 000003 000001 000000 101400 004004 000064 000000
0000040 003610 000000 000000 000000 000064 000040 000006 000050
0000060 000033 000030 000006 000000 000064 000000 100064 004004
0000100 100064 004004 000300 000000 000300 000000 000005 000000
0000120 000004 000000 000003 000000 000364 000000 100364 004004
0000140 100364 004004 000023 000000 000023 000000 000004 000000
0000160 000001 000000 000001 000000 000000 000000 100000 004004
0000200 100000 004004 002121 000000 002121 000000 000005 000000
0000220 010000 000000 000001 000000 002124 000000 112124 004004

Here is an example of od used to diagnose the output of echo where the user types Ctrl+V+Ctrl+I and Ctrl+V+Ctrl+C after writing "Hello" to literal insert a tab and ^C character:

% echo "Hello    ^C" | od -cb
0000000   H   e   l   l   o  \t 003  \n
        110 145 154 154 157 011 003 012
0000010

See also

References

  1. ^ "Native Win32 ports of some GNU utilities". unxutils.sourceforge.net.
  2. ^ IBM. "IBM System i Version 7.2 Programming Qshell" (PDF). IBM. Retrieved 2020-09-05.
Kembali kehalaman sebelumnya


Index: pl ar de en es fr it arz nl ja pt ceb sv uk vi war zh ru af ast az bg zh-min-nan bn be ca cs cy da et el eo eu fa gl ko hi hr id he ka la lv lt hu mk ms min no nn ce uz kk ro simple sk sl sr sh fi ta tt th tg azb tr ur zh-yue hy my ace als am an hyw ban bjn map-bms ba be-tarask bcl bpy bar bs br cv nv eml hif fo fy ga gd gu hak ha hsb io ig ilo ia ie os is jv kn ht ku ckb ky mrj lb lij li lmo mai mg ml zh-classical mr xmf mzn cdo mn nap new ne frr oc mhr or as pa pnb ps pms nds crh qu sa sah sco sq scn si sd szl su sw tl shn te bug vec vo wa wuu yi yo diq bat-smg zu lad kbd ang smn ab roa-rup frp arc gn av ay bh bi bo bxr cbk-zam co za dag ary se pdc dv dsb myv ext fur gv gag inh ki glk gan guw xal haw rw kbp pam csb kw km kv koi kg gom ks gcr lo lbe ltg lez nia ln jbo lg mt mi tw mwl mdf mnw nqo fj nah na nds-nl nrm nov om pi pag pap pfl pcd krc kaa ksh rm rue sm sat sc trv stq nso sn cu so srn kab roa-tara tet tpi to chr tum tk tyv udm ug vep fiu-vro vls wo xh zea ty ak bm ch ny ee ff got iu ik kl mad cr pih ami pwn pnt dz rmy rn sg st tn ss ti din chy ts kcg ve 
Prefix: a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9