I have a binary file and i want to replace the value A2
at address DEADBEEF
with some other value, say A1
.
How can I do this with dd
? If there are other tools that can do this, please suggest. But I plan to do this on iPhone so I can only work with most basic Unix tools.
Short answer to the question in the subject: yes, if the of argument refers to a disk partition , the dd command will overwrite the existing data on the partition.
The dd seek option is similar to the UNIX lseek() system call1. It moves the read/write pointer within the file. From the man page: seek=n Skip n blocks (using the specified output block size) from the beginning of the output file before copying.
printf '\xa1' | dd conv=notrunc of=somefile bs=1 seek=$((0xdeadbeef))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With