# radare2 personal cheatsheet

```
r2 -w ./file # open file for patching
```

### Main Commands

* **aaa**  -  analyze everything
* **pdf function / pd 20 @function** - print disassembly at function
* **s 0x4000** - seek address /s+ s- for relative seek
* **VV @function** - Enter Graph View at function
* **iz** - print strings
* **@** - use for temporary seek
* **\~**  - like grep
* **px** - print hexdump
* **ia** - info all
* **wa** - write assembly
* **afl** - list functions
* **axt \[offset]** -  find xrefs
* **/ \[string]** - search strings
* **o** - work with file descriptors
* **afta** - analyze local variable types

### Visual Modes

* **V** - Enter Normal Visual mode
* **VV** - Enter Graph View
* **V!** - Enter Panel View
* **A** - patch at current address
* **p** - rotate print mode
* **:** - open command line

### Tricks

* append **j** to a command for json output
* append **\~{}** to command for json pretty print
* use pipe **|** with shell commands
* use **>** to pipe outputs to file
* **wx 9090** - write nop at current address
* use initialization scripts to do the basic startup tasks

### Customization

* **eco** - colorschemes, e.g. **eco darkda**
* **e scr.utf8 = true**
* **e scr.utf8.curvy=true**

### Debugger

* **r2 -d ./file**
* **db 0x0000** - breakpoint at 0x0000
* **dc** - run
* **ds** - step
* **dcs** - continue until syscall
* **dd** - manipulate file descriptors
* **dr eax=5** - manipulate reg value
* **s** - step (visual)
* **S** - step, not into calls (visual)

<https://radare.gitbooks.io/radare2book/debugger/migration.html>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://blog.conspirator.io/tools/untitled.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
