Why not use xxd
? Use it like so: xxd -b file
For example, doing a xxd -b google-chrome-stable_current_i386.deb | head
gives:
0000000: 00100001 00111100 01100001 01110010 01100011 01101000 !<arch 0000006: 00111110 00001010 01100100 01100101 01100010 01101001 >.debi 000000c: 01100001 01101110 00101101 01100010 01101001 01101110 an-bin 0000012: 01100001 01110010 01111001 00100000 00100000 00100000 ary 0000018: 00110001 00110100 00110000 00111001 00110111 00111001 140979 000001e: 00110001 00111000 00110001 00110101 00100000 00100000 1815 0000024: 00110000 00100000 00100000 00100000 00100000 00100000 0 000002a: 00110000 00100000 00100000 00100000 00100000 00100000 0 0000030: 00110001 00110000 00110000 00110110 00110100 00110100 100644 0000036: 00100000 00100000 00110100 00100000 00100000 00100000 4
If you want, you can use cut
to chop off the left-most column and the right-most column by doing xxd -b google-chrome-stable_current_i386.deb | head | cut -b10-62
:
00100001 00111100 01100001 01110010 01100011 01101000 00111110 00001010 01100100 01100101 01100010 01101001 01100001 01101110 00101101 01100010 01101001 01101110 01100001 01110010 01111001 00100000 00100000 00100000 00110001 00110100 00110000 00111001 00110111 00111001 00110001 00111000 00110001 00110101 00100000 00100000 00110000 00100000 00100000 00100000 00100000 00100000 00110000 00100000 00100000 00100000 00100000 00100000 00110001 00110000 00110000 00110110 00110100 00110100