# 3.8 Write

Radare can manipulate the file in multiple ways. You can resize the file, move bytes, copy/paste them, insert mode (shifting data to the end of the block or file) or just overwrite some bytes with an address, the contents of a file, a widestring or inline assembling an opcode.

To resize. Use the 'r' command which accepts a numeric argument. Possitive valule sets the new size to the file. A negative one will strip N bytes from the current seek down-sizing the file.

    > r 1024      ; resize the file to 1024 bytes
    > r -10 @ 33  ; strip 10 bytes at offset 33

To write bytes just use the 'w' command. It accepts multiple input formats like inline assembling, endian-friendly dwords, files, hexpair files, wide strings:

    [0x4A13B8C0]> w?
    Usage: w[?|*] [argument]
      w  [string]        ; write plain with escaped chars string
      wa [opcode]        ; write assembly using asm.arch and rasm
      wA '[opcode]'      ; write assembly using asm.arch and rsc asm
      wb [hexpair]       ; circulary fill the block with these bytes
      wv [expr]          ; writes 4-8 byte value of expr (use cfg.bigendian)
      ww [string]        ; write wide chars (interlace 00s in string)
      wf [file]          ; write contents of file at current seek
      wF [hexfile]       ; write hexpair contents of file
      wo[xrlaAsmd] [hex] ; operates with hexpairs xor,shiftright,left,add,sub,mul,div

Some examples:

    > wx 12 34 56 @ 0x8048300
    > wv 0x8048123 @ 0x8049100
    > wa jmp 0x8048320

All write changes are recorded and can be listed or undo-ed using the 'u' command which is explained in the 'undo/redo' section.

- 3.8.1 Write over with operation