Hacker News new | past | comments | ask | show | jobs | submit login

You right. To skip you can pipe tail.

sudo head -c 1024 /dev/sda | tail -zc 512 > /tmp/boot.2

Read 1024, keep last 512




What if the position is not at 512 but at 512G?


Not tested, by I think the performance will be in the same order. Would be nice to do a benchmark test.


No, it is O(n) vs O(1). Why would you read 512G + 512 bytes if you only need to read 512 bytes at offset 512G?


I think you can just invert and do tail first

sudo tail -zc +513 /dev/sda | head -c 512 > /tmp/boot.2


Well now you're seeking to the offset (tail is).




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: