APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

using dd


From: Tony Lawrence <tony@pcunix.com>
Subject: Re: Command Line Length, Upper Limit?
Date: Wed, 15 Jan 2003 20:16:03 GMT

Mark Conrad wrote:
> In article <JXbV9.687809$WL3.722374@rwcrnsc54>, Tony Lawrence
> <tony@pcunix.com> wrote:
> 
> 
>>>The main sticking point is that I don't know how to execute the
>>>necessary 3rd-party application "HexEdit" from the command-line.
>>
>>AppleScript.  Which can be embedded in your shell script with osascript...
> 
> 
> Thanks for that tip, I looked at 'man osascript' and it looks like it
> would work.
> 
> 
> 
>>However, why use Hexedit?  Looks to me (not that I've read carefully 
>>through that mess) like you  are just changing some bytes - put 'em 
>>in a file and use ddd to slap 'em  where you want them.
> 
> 
> I thought you would never ask<g>
> 
> The reason I use HexEdit along with dd is because dd can't write to
> specific free-space bytes in certain areas of disk, like for example
> the Driver Descriptor Map area (absolute disk sector zero)

If dd can read it, dd can write it.  Or are you saying you don't know 
WHERE to write until you see it in hex edit?


You can skip right by bytes with dd and write any number of new bytes 
you like.  A simple example:

echo "AAAAAAAAAA" > /tmp/a
echo "BBB" > /tmp/b

dd if=/tmp/b bs=1 count=3 seek=2 conv=notrunc of=/tmp/a
cat /tmp/a

(notrunc is necessary with regular files; see the man page)




Got something to add? Send me email.




Increase ad revenue 50-250% with Ezoic

Kerio Samepage


Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us





Technology is both a tool for helping humans and for destroying them. This is the paradox of our times which we're compelled to face. (Frank Herbert)





This post tagged: