oflag option in GNU dd - equivalent in FreeBSD dd ?

Oliver Fromme olli at lurza.secnetix.de
Tue Oct 23 08:18:44 PDT 2007

Bahman M. <b.movaqar at adempiere.org> wrote:
 > On 2007-10-22 Juri Mianovich wrote:
 > > I am used to using this command in Linux, using GNU
 > > dd:
 > > 
 > > dd if=/blah of=/bleh oflag=append conv=notrunc
 > > 
 > > The problem is, FreeBSD 'dd' does not understand the
 > > "oflag" argument.
 > > 
 > > Is there some equivalent in the FreeBSD 'dd' syntax
 > > that I can use, or am I forced to install GNU utils ?

Of course, the easiest way is to do this:

$ dd if=/blah >> /bleh

If you cannot do that, please explain why.  If you know
your reason, there might be an alternative way to do it.

 > dd if=/blah of=/bleh conv=notrunc seek=`ls -s /bleh | cut -f1 -d ' ' -`
 > I don't know if any simpler way is possible (anyone?).

$ dd if=/blah of=/bleh conv=notrunc seek=$(stat -f%z /bleh)

I suggest to write a small alias or shell function if
you need to use such commands often.  The following
shell function (for sh, zsh or bash) will do:

	dd if="$1" of="$2" conv=notrunc seek=$(stat -f%z -- "$2")

Then you can simply write:  $ ddappend /blah /bleh

Best regards

Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606,  Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün-
chen, HRB 125758,  Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart

FreeBSD-Dienstleistungen, -Produkte und mehr:  http://www.secnetix.de/bsd

Passwords are like underwear.  You don't share them,
you don't hang them on your monitor or under your keyboard,
you don't email them, or put them on a web site,
and you must change them very often.

More information about the freebsd-questions mailing list