Questions tagged [xxd]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
0 answers
237 views

Prevent xxd from adding newline to the output

On unix if I do printf "aY.S'Hk([;jYJ}8eJ5)Wsd58/x}s]Pne3V-6:t@" | xxd -p -c 256 I get 61592e5327486b285b3b6a594a7d38654a352957736435382f787d735d50 6e6533562d363a7440 However on mac os (...
2 votes
2 answers
967 views

How to format hexdump as xxd, possible for xxd -revert?

I wish to dump the raw content of a SD card into a file for inspection. Most parts of it are zeroes. Learnt from this SuperUser answer I could use pv to show the progress of od and hexdump. Both ETA ...
  • 275
9 votes
2 answers
2k views

How to print zeros and ones of a file

Long story short: how to print in a terminal the binary digits constituting a file e.g. a library .so or a simple text .txt file PC hardware works with electrical signal (basically it's an ON/OFF ...
  • 2,947
2 votes
1 answer
268 views

How to modify a hex string to LE-format before passing it to `xxd -r` to view its binary contents?

The hex string 0068732f6e69622f represents the ASCII string /bin/sh, when it's stored in memory in LE-format. Is there any Linux utiltity that will take the hex string and reverse it bytes (...
  • 3,659
0 votes
1 answer
500 views

How to `watch` output of `xxd` or `hexdump` command?

My tool is wtiting binary chars to stdout and I can view it in hex with # ./md /dev/ttyUSB0 | xxd 0000000: 6f03 1100 0003 0084 8400 0000 0900 0a00 o............... 0000010: 0008 0004 0000 0000 2c00 ...
  • 2,835
-6 votes
1 answer
345 views

Just started learning Kali Linux 3 weeks ago need help with maybe a hex dump?

For an assignment I was given this problem: What has 8 faces and cannot see? followed by this character set: ...
1 vote
1 answer
281 views

Patch Multiple Strings in a Binary file

I have a binary file type (many instances of these files) where I would like to replace the string "DC-GX850" with "DMC-GX95". Fortunately the two strings are of equal length. The ...
0 votes
2 answers
293 views

Parse text file with addresses, byte values, and comments to binary file

I'm attempting to start with a file in the following form: 00: 42 ; byte 0 is 0x42 / d 01: 52 ; byte 1 is 0x52 / r 02: 62 ; byte 2 is 0x62 / D 03: 72 ; byte 3 is 0x72 / R 07: 1f ; bytes 03..0e are ...
  • 123
7 votes
2 answers
8k views

What is the difference between the od, hd, hexdump and xxd commands?

What is the difference between the od, hd, hexdump and xxd commands ? They are all commands for dumping files and they can all dump it in various formats such as hexadecimal, octal or binary. Why ...
  • 265
2 votes
1 answer
2k views

Make xxd display the the byte offset at the top column?

So Im using emacs which has a stupendous hexl-mode to view the byte offset in a file right over the hex values similar to: 87654321 0011 2233 4455 6677 8899 aabb ccdd eeff 0123456789abcdeff ...
  • 148
2 votes
2 answers
6k views

xxd with 64 bit addresses

I find xxd to be nice and convenient for simple manipulation of binary data in the terminal. However it has a limitation in that all addresses outputted by the program is limited to 32 bits. E.g. ...
  • 186
4 votes
1 answer
9k views

Hex dump only the beginning and the end of a file with xxd [duplicate]

I am looking for a command to display three .png files using xxd, displaying the first two and last two lines of the hexadecimal for each. I have used the command below to display one file at a time ...
  • 121
1 vote
1 answer
2k views

Outputting the binary of a file to a text editor

I have read that you can use the terminal command xxd -b to see the binary of a file. I used this command and it does show the binary but has non-binary listed to the left as line numbers and non-...
  • 11
2 votes
2 answers
20k views

Unix: Using the xxd Command on a ppm File

I am fairly new to unix and am having trouble understanding what some of the commands do.For example, when I use xxd on a ppm file (i.e. xxd image.ppm) I get an output like this: 00000000: 5036 0a31 ...
2 votes
1 answer
2k views

How to make "xxd" place spaces between the hex values?

I am using the following command to read the output of one terminal from another terminal: xxd -p /dev/pts/0 But there is no spaces between the hex values, for example I get something like this: ...
  • 123
2 votes
1 answer
892 views

Make xxd break lines

For showing the content of a file with both formatted text and binary data inside in another post on SE I couldn't decide on wheather to show the ASCII rendered output or a the xxd output. As a ...
  • 23
2 votes
1 answer
2k views

Why does xxd not show the byte order mark?

I have a Java class which the compiler refuses to compile due to \ufeff at the start of the file. I can view the fact that the BOM is present by vim -b file.java, but neither xxd nor hexdump show the ...
  • 374
7 votes
2 answers
13k views

Any way to send just "\n" in Telnet?

I'm wondering if there's any way to get telnet to send only a \n, not a \r\n. For example, if one process is listening on a port like this, to print the bytes of any traffic received: nc -l 1234 | ...
  • 81
2 votes
2 answers
1k views

“xxd -p” alternative for HP-UX - how to get the same results with “xd”?

I have a command which is very handy at work. It searches for a certain STRING inside some hex raw files with FILENAME. The command which I always used in Linux systems is: find . -name '**FILENAME*...
0 votes
1 answer
175 views

Hex has unknown character / in the output

I need to create a Rc2Key variable and then convert this to hexadecimal. I have done this with two commands. The Rc2Key variable has to be 16 characters long, so in my test module I used "...
  • 17
2 votes
1 answer
444 views

Unified diff-alikes with xxd

patch(1) on FreeBSD does not support null bytes. With GNU diff/patch I could handle multiple files containing null bytes with one patch, but xxd (which handles null bytes) does not seem to support ...
24 votes
2 answers
53k views

xxd output without line breaks

Can I tell xxd to not print any line breaks in its output and have my dump as one continuous line? [user@localhost] : ~ $ echo -n "this is a long line and xxd is going to take multiple lines to print ...
  • 3,525
4 votes
3 answers
5k views

Split binary data of fixed byte offset by byte position?

I have binary data which I review by xxd -ps in hex format. I notice that the byte distance is 48300 (=805*60) bytes between two headers where the separator is fafafafa. There is the beginning of ...
49 votes
6 answers
42k views

How to dump a binary file as a C/C++ string literal?

I have a binary file I would like to include in my C source code (temporarily, for testing purposes) so I would like to obtain the file contents as a C string, something like this: \x01\x02\x03\x04 ...
  • 6,188