4 ms·
You can use head as stated in the article: sudo dd if=/dev/sda of=/tmp/boot.1 bs=512 count=1 sudo head -c 512 /dev/sda > /tmp/boot.2 md5sum /tmp/boot.1 06d6
by fbn79 4y ago
You can use head as stated in the article:
sudo dd if=/dev/sda of=/tmp/boot.1 bs=512 count=1
sudo head -c 512 /dev/sda > /tmp/boot.2
md5sum /tmp/boot.1
06d6f2aa3e7c33ad06282f70aa4e133b /tmp/boot.1
md5sum /tmp/boot.2
06d6f2aa3e7c33ad06282f70aa4e133b /tmp/boot.2
- merlincorey 4y agoYou missed a nuance in the GP's problem set: > dd if=random-linux-image.img of=/dev/mmcblk0 bs=512 count=62499 seek=1 skip=1 is not the same as: > sudo dd if=/dev/sda of=/tmp/boot.1 bs=512 count=1 You are missing the "seek" and "skip" arguments which the GP challenges you to make `head` do.
- fbn79 4y agoYou right. To skip you can pipe tail. sudo head -c 1024 /dev/sda | tail -zc 512 > /tmp/boot.2 Read 1024, keep last 512
- jstimpfle 4y agoWhat if the position is not at 512 but at 512G?
- knorker 4y agoThat "sudo head" only works for reading, not writing though. I use dd when redirect doesn't have permission.
- guenthert 4y agoI've seen tee used for that, but I myself stick to dd (out of habbit or because I belong to said cult).