Try using
xxd
on linux to show your binary data as hex:
[k5054@localhost tmp]$ cat hellow.cpp
#include <iostream>
int main()
{
std::cout << "Hello World!\n";
}
[k5054@localhost tmp]$ xxd -g1 hellow.cpp
00000000: 23 69 6e 63 6c 75 64 65 20 3c 69 6f 73 74 72 65 #include <iostre
00000010: 61 6d 3e 0a 0a 69 6e 74 20 6d 61 69 6e 28 29 0a am>..int main().
00000020: 7b 0a 20 20 20 20 73 74 64 3a 3a 63 6f 75 74 20 {. std::cout
00000030: 3c 3c 20 22 48 65 6c 6c 6f 20 57 6f 72 6c 64 21 << "Hello World!
00000040: 5c 6e 22 3b 0a 7d 0a \n";.}.
The
-g1
parameter groups the output by single bytes, the default is 2. See the man page for details
Update
xxd has a reverse option
-r
which takes an xxd dump and writes out binary. I took your Windows hex-dump from above, saved it to a file and trimmed off the header.
[k5054@localhost tmp]$ xxd -r data.txt data.bin
[k5054@localhost tmp]$ file data.txt data.bin
data.txt: ASCII text
data.bin: data
[k054@localhost tmp]$ xxd -g1 data.bin
00000000: 01 00 2a 00 0a 00 00 00 03 09 8e 07 00 00 00 80 ..*.............
00000010: 07 00 00 38 04 00 00 5f 01 00 00 01 00 00 00 eb ...8..._........
00000020: e8 00 00 00 00 00 00 00 00 00 00 b8 01 00 00 2f .............../
00000030: 02 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000040: 4a ea 00 00 02 00 00 00 b2 87 04 00 00 00 00 00 J...............
00000050: 00 00 00 00 f9 02 00 00 e8 03 00 00 03 00 00 00 ................
00000060: 00 00 00 00 00 00 00 00 00 fc 71 05 00 03 00 00 ..........q.....
00000070: 00 19 2b 00 00 00 00 00 00 00 00 00 00 40 01 00 ..+..........@..
00000080: 00 f0 00 00 00 03 00 00 00 00 00 00 00 00 00 00 ................
00000090: 00 00 15 9d 05 00 04 00 00 00 80 61 01 00 00 00 ...........a....
000000a0: 00 00 00 00 00 00 80 02 00 00 e0 01 00 00 03 00 ................
000000b0: 00 00 00 00 00 00 00 00 00 00 00 95 fe 06 00 05 ................
000000c0: 00 00 00 f0 6d 08 00 00 00 00 00 00 00 00 00 fc ....m...........
000000d0: 02 00 00 89 05 00 00 03 00 00 00 00 00 00 00 00 ................
000000e0: 00 00 00 00 85 6c 0f 00 06 00 00 00 ee e5 01 00 .....l..........
000000f0: 00 00 00 00 00 00 00 00 90 01 00 00 20 02 00 00 ............ ...
00000100: 03 00 00 00 00 00 00 00 00 00 00 00 00 73 52 11 .............sR.
00000110: 00 07 00 00 00 45 df 03 00 00 00 00 00 00 00 00 .....E..........
00000120: 00 bc 02 00 00 04 02 00 00 03 00 00 00 00 00 00 ................
00000130: 00 00 00 00 00 00 b8 31 15 00 08 00 00 00 80 39 .......1.......9
00000140: 00 00 00 00 00 00 00 00 00 00 f4 01 00 00 3e 01 ..............>.
00000150: 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 ...............