HackMD
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # radare2 cmd syntax ``` Command = '!' Shell | Statement { ';' Statement } | QuotedStatement QuotedStatement = Statement - Redirection - TmpSeek + ';' Statement = Head {Arg} Redirection? TmpSeek? Grep? TmpSeek = '@' (addr ('!' blocksize)? [0x1000011e0]> ?@? |Usage: [.][#]<cmd>[*] [`cmd`] [@ addr] [~grep] [|syscmd] [>[>]file] | 0 alias for 's 0' | 0xaddr alias for 's 0x..' | #cmd if # is a number repeat the command # times | /* start multiline comment | */ end multiline comment | .cmd execute output of command as r2 script | .:8080 wait for commands on port 8080 | .!rabin2 -re $FILE run command output as r2 script | * output of command in r2 script format (CC*) | j output of command in JSON format (pdj) | @ 0x1024 temporary seek to this address (sym.main+3) | @ [addr]!blocksize temporary set a new blocksize | @a:arch[:bits] temporary set arch and bits | @b:bits temporary set asm.bits | @e:k=v,k=v temporary change eval vars | @r:reg tmp seek to reg value (f.ex pd@r:PC) | @i:nth.op temporary seek to the Nth relative instruction | @f:file temporary replace block with file contents | @o:fd temporary switch to another fd | @s:string same as above but from a string | @x:909192 from hex pairs string | @..from to temporary set from and to for commands supporting ranges | @@=1 2 3 run the previous command at offsets 1, 2 and 3 | @@ hit* run the command on every flag matching 'hit*' | @@?[ktfb..] show help for the iterator operator | @@@ [type] run a command on every [type] (see @@@? for help) Input Slurp from file or stdin '<' | has been removed to avoid issues with confused users or hangs Redirection = '>' filename | >file pipe output of command to file | >>file append to file | H>file pipe output of command to file in HTML | H>>file append to file with the output of command in HTML | `pdi~push:0[0]` replace output of command inside the line | |cmd pipe output to command (pd|less) (.dr*) Grep = '~' [^"`] | ~? count number of lines (like wc -l) | ~?? show internal grep help | ~.. internal less | ~{} json indent | ~{}.. json indent and less | ~word grep for lines matching word | ~!word grep for lines NOT matching word | ~word[2] grep 3rd column of lines matching word | ~word:3[0] grep 1st column from the 4th line matching word + see ## Use of ~ Head = [-+=A-Za-z0-9.*!?/] # '?' (not followed by '*') '-' '+' ends parsing Arg = ([-/+*^A-Za-z0-9.,_=\[\]?{}$] | Escape)* ``` ## Use of `$` ``` aetr ==,$z x $(x) ``` ## Use of `^` ``` ?v 32^'a' ``` ## Use of ~ ``` [0x1000011e0]> ~? |Usage: [command]~[modifier][word,word][endmodifier][[column]][:line] modifier: | & all words must match to grep the line | $[n] sort numerically / alphabetically the Nth column | + case insensitive grep (grep -i) | ^ words must be placed at the beginning of line | ! negate grep | ? count number of matching lines | ?. count number chars | ?? show this help message | :[s]-[e] show lines s-e | .. internal 'less' | ... internal 'hud' (like V_) | {} json indentation | {path} json grep | {}.. less json indentation | endmodifier: | $ words must be placed at the end of line | column: | [n] show only column n | [n-m] show column n to m | [n-] show all columns starting from column n | [i,j,k] show the columns i, j and k | Examples: | i~:0 show first line of 'i' output | i~:-2 show first three lines of 'i' output | pd~mov disasm and grep for mov | pi~[0] show only opcode | i~0x400$ show lines ending with 0x400 [0x1000011e0]> ``` ## Use of $ [0x1000011e0]> ?$? |Usage: ?v [$.] | $$ here (current virtual seek) | $? last comparison value | $alias=value Alias commands (simple macros) | $b block size | $B base address (aligned lowest map address) | $f jump fail address (e.g. jz 0x10 => next instruction) | $fl flag length (size) at current address (fla; pD $l @ entry0) | $F current function size | $FB begin of function | $Fb address of the current basic block | $Fs size of the current basic block | $FE end of function | $FS function size | $Fj function jump destination | $Ff function false destination | $FI function instructions | $c,$r get width and height of terminal | $Cn get nth call of function | $Dn get nth data reference in function | $D current debug map base address ?v $D @ rsp | $DD current debug map size | $e 1 if end of block, else 0 | $j jump address (e.g. jmp 0x10, jz 0x10 => 0x10) | $Ja get nth jump of function | $Xn get nth xref of function | $l opcode length | $m opcode memory reference (e.g. mov eax,[0x10] => 0x10) | $M map address (lowest map address) | $o here (current disk io offset) | $p getpid() | $P pid of children (only in debug) | $s file size | $S section offset | $SS section size | $v opcode immediate value (e.g. lui a0,0x8010 => 0x8010) | $w get word size, 4 if asm.bits=32, 8 if 64, ... | ${ev} get value of eval config variable | $k{kv} get value of an sdb query value | RNum $variables usable in math expressions ## Use of . [0x1000011e0]> .?? |Usage: .[r2cmd] | [file] | [!command] | [(macro)] # define macro or load r2, cparse or rlang file | . repeat last command backward | .r2cmd interpret the output of the command as r2 commands | .. repeat last command forward (same as \n) | .:8080 listen for commands on given tcp port | . foo.r2 interpret r2 script | .- open cfg.editor and interpret tmp file | .!rabin -ri $FILE interpret output of command | .(foo 1 2 3) run macro 'foo' with args 1, 2, 3 | ./ ELF interpret output of command /m ELF as r. commands ## Use of ! ``` [0x1000011e0]> !?? |Usage: !<cmd> Run given command as in system(3) | ! list all historic commands | !ls execute 'ls' in shell | !! save command history to hist file | !!ls~txt print output of 'ls' and grep for 'txt' | .!rabin2 -rpsei ${FILE} run each output line as a r2 cmd | !echo $SIZE display file size | !- clear history in current session | !-* clear and save empty history log | !=! enable remotecmd mode | =!= disable remotecmd mode | Environment: | R2_FILE file name | R2_OFFSET 10base offset 64bit value | R2_BYTES TODO: variable with bytes in curblock | R2_XOFFSET same as above, but in 16 base | R2_BSIZE block size | R2_ENDIAN 'big' or 'little' | R2_IOVA is io.va true? virtual addressing (1,0) | R2_DEBUG debug mode enabled? (1,0) | R2_BLOCK TODO: dump current block to tmp file | R2_SIZE file size | R2_ARCH value of asm.arch | R2_BITS arch reg size (8, 16, 32, 64) | RABIN2_LANG assume this lang to demangle | RABIN2_DEMANGLE demangle or not | PDB_SERVER e pdb.server ``` ## Use of () [0x1000011e0]> (?? |Usage: (foo args,cmd1,cmd2,..)Aliases | (foo args,..,..) define a macro | (foo args,..,..)() define and call a macro | (-foo) remove a macro | .(foo) to call it | () break inside macro | (* list all defined macros | Argument support: | (foo x y, $0 @ $1) define fun with args (x - $0, y - $1) | .(foo 128 0x804800) call it with args | Iterations: | .(foo,() $@) define iterator returning iter index | x @@ .(foo) iterate over them

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully