Skip to main content

Questions tagged [xxd]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
2 answers
37 views

From hexdump to ascii (xxd -r stuck writing zero bytes)

To diagnose secure boot issues, I'm looking at the sbat sections of all bootloaders on a machine: sudo sh -c 'for f in /boot/efi/EFI/*/*.efi; do echo "$f"; objdump -j .sbat -s "$f" ...
Tobu's user avatar
  • 6,620
0 votes
1 answer
1k views

What does xxd -r -p do?

So I am trying to calculate a SHA1 digest (and base64 encode it) for an attachment I received so it matches their (base64 encoded) digest. Using ChatGPT, I was able to use the command below to succeed....
geckels1's user avatar
  • 153
0 votes
4 answers
229 views

awk command to map ASCII char to hex code not working

I'm experimenting with awk and I thought it would be a cool idea to write a small program that maps every ASCII char with its hex code. this is what ive done so far: The string is: ...
Mathew's user avatar
  • 243
0 votes
1 answer
215 views

tying together the 'xxd' command with output

I have the following hex dump: 00000000: 2345 5854 5241 530a 0a31 2e20 746f 2061 #EXTRAS..1. to a 00000010: 6464 2075 7365 723a 2060 7375 646f 2075 dd user: `sudo u 00000020: 7365 7261 6464 205b ...
Mathew's user avatar
  • 243
8 votes
1 answer
940 views

Why is 0x00 being deleted when assigning a base64 decoded string to a variable

I'm using a Mac. In Bash, I'm trying to decode a base64 string and then try to print the Hex value. I'm using base64 -d command and then assigning it to a variable. myText='YYN29+...
SilleBille's user avatar
1 vote
1 answer
185 views

Should the `xxd` utility be listed as a dependency in my application?

I'm distributing a desktop application and I'm unsure if xxd should be listed as a (build) dependency. My first though was not, since it's documented in the Linux manpages and therefore should be ...
paoloose's user avatar
1 vote
1 answer
588 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 (...
java_doctor_101's user avatar
3 votes
2 answers
2k 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 ...
midnite's user avatar
  • 443
10 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 ...
mattia.b89's user avatar
  • 3,268
2 votes
1 answer
526 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 (...
Shuzheng's user avatar
  • 4,541
0 votes
1 answer
821 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 ...
Dims's user avatar
  • 3,255
-6 votes
1 answer
429 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: ...
Scalz15's user avatar
1 vote
1 answer
594 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 ...
Eric Valk's user avatar
0 votes
2 answers
431 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 ...
Bitbang3r's user avatar
  • 123
9 votes
2 answers
12k 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 ...
Nicryc's user avatar
  • 295
2 votes
1 answer
3k 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 ...
LFMekz's user avatar
  • 148
2 votes
2 answers
7k 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. ...
Christer's user avatar
  • 186
4 votes
1 answer
12k 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 ...
Deirdre's user avatar
  • 131
1 vote
1 answer
4k 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-...
Sand's user avatar
  • 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 ...
Shoaib Ahmed's user avatar
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: ...
Tom's user avatar
  • 123
2 votes
1 answer
1k 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 ...
stuquus's user avatar
  • 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 ...
oarfish's user avatar
  • 414
7 votes
2 answers
16k 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 | ...
shelly's user avatar
  • 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*...
EXHALEXHALE's user avatar
0 votes
1 answer
220 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 "...
DJLee's user avatar
  • 17
2 votes
1 answer
512 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 ...
Janus Troelsen's user avatar
27 votes
2 answers
60k 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 ...
Juicy's user avatar
  • 3,935
4 votes
3 answers
6k 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 ...
Léo Léopold Hertz 준영's user avatar
55 votes
6 answers
47k 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 ...
Malvineous's user avatar
  • 6,963