10:36 PM HEXDUMP command in Linux to display the file content in decimal, hexadecimal, octal format | ||||
hexdump - is a Linux utility to dump the file content into ascii, decimal, hexadecimal, octal formats. It accepts the input from a file or from standard input and creates a dump in ASCII, octal. hexadecimal or decimal formats. FORMAT DESCRIPTION The options are as follows: -x Two-byte hexadecimal display. Display the input offset in hexadecimal, followed by eight, space separated, four column, zero-filled, two-byte quantities of input data, in hexadecimal, per line. shanky@localhost:~> hexdump -x abc.txt Note:- Here we may notice that the hexdump is showing the file content i.e. "abcd" in two byte hexadecimal format. The utility takes two byte chunk "ab" and shows as 6261 because hexadecimal value of a and b is 61 and 62 and they are displayed from LSB(least significant bit) to MSB(Most significant byte)
again the next byte is new line "\n" whose ASCII value is 10 and hexadecimal value is 0x0a which is displayed. On the next line we have "0000005" which means that 5 bytes have been dumped 4 bytes for "abcd" and one byte for "\n".
-b One-byte octal display. Display the input offset in hexadecimal, followed by sixteen space-separated, three column, zero-filled, bytes of input data, in octal, per line. shanky@localhost:~> cat abc.txt shanky@localhost:~> hexdump -b abc.txt
-c One-byte character display. Display the input offset in hexadecimal, followed by sixteen space-separated, three column, space-filled, characters of input data per line. shanky@localhost:~> hexdump -c abc.txt
-C Canonical hex+ASCII display. Display the input offset in hexadecimal, followed by sixteen space-separated, two column, hexadecimal bytes, followed by the same sixteen bytes in %_p format enclosed in ``|'' characters. shanky@localhost:~> hexdump -C abc.txt
-d Two-byte decimal display. Display the input offset in hexadecimal, followed by eight space-separated, five column, zero-filled, two-byte units of input data, in unsigned decimal, per line. shanky@localhost:~> hexdump -d abc.txt
The iteration count is an optional positive integer, which defaults to one. Each format is applied iteration count times. The byte count is an optional positive integer. If specified it defines the number of bytes to be interpreted by each iteration of the format. Examples:
For each input file, hexdump sequentially copies the input to standard output, transforming the data according to the format strings specified by the -e and -f options, in the order that they were specified. | ||||
|
Related blogs
You may also like to see:
[2014-10-26] | [Open System-Linux] |
XMLLINT command in linux : a validating XML parser |
[2014-10-06] | [Open System-Linux] |
Time command in Linux to give resource usage |
[2014-03-13] | [Open System-Linux] |
crontab: A command in linux to automatically start/repeat a process at certian time and interval |
[2014-05-22] | [Open System-Linux] |
Archiving and compression of files in Linux |
[2015-08-18] | [Open System-Linux] |
How to open a PDF file or a Postscript file in Linux - Evince Document viewer? |
Total comments: 0 | |