How to do a hex-dump of anything.
cat binary | xxd
cat binary | od -t x2 -t c
Or just convert non-printable characters into printable ones:
cat binary | od -c
###### xd -- hexdump #!/usr/bin/perl # do a hex-dump, similar to "xxd" use strict; use warnings; my @fill = (" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "); hexdump(*STDIN) unless @ARGV; foreach my $file (@ARGV) { print "File: ", $file, "\n"; open IN, $file; hexdump(*IN); close IN; } sub hexdump { local *IN = shift; my ($form, $buf, $i); while (my $rb = read(IN, my $buf, 16)) { my @x = unpack("H2" x $rb, $buf); $buf =~ s/[\x00-\x1f\x7f-\xff]/./g; $buf .= ' ' x (16-length($buf)); printf "%06x0: %s %s\n", $i++, sprintf ("%s%s %s%s %s%s %s%s %s%s %s%s %s%s %s%s", @x, @fill), $buf; } }