Skip to content

phil-base/hexfriend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hexfriend

An interactive terminal hex editor. Loads a file into memory and lets you view, navigate, and edit bytes directly, then save the result.

Building

make

Requires ncurses. On macOS it is present by default. On Linux:

sudo apt-get install libncurses-dev

Usage

./hexfriend myfile.bin   # open a file
./hexfriend --new        # start with an empty buffer
./hexfriend              # prompts for a filename; Enter for new

Layout

 hexfriend — myfile.bin                                         1234 bytes
────────────────────────────────────────────────────────────────────────────
000000  23 64 65 66 69 6e 65 20  5f 50 4f 53 49 58 5f 43  │#define _POSIX_C│
000010  5f 53 4f 55 52 43 45 20  32 30 30 38 30 39 4c 0a  │_SOURCE 200809L.│
...
────────────────────────────────────────────────────────────────────────────
 HEX | 0x000000 | af:edit  i:ins  x:del  u:undo  ...

The active nibble in the hex panel is highlighted. The corresponding character in the ASCII panel is underlined (and vice versa when in ASCII mode). A [*] in the header means there are unsaved changes.

Key bindings

Navigation (both panels)

Key Action
Arrow keys Move cursor
Page Up / Down Scroll one screen
Home Go to start of file
End Go to end of file
Tab Switch between hex and ASCII panels

Hex panel

Key Action
09, af Edit byte (type two hex digits)
i Insert a zero byte at cursor
x / Delete Delete byte at cursor
u Undo last change
/ Find byte sequence (space-separated hex, e.g. ff 0a)
n Find next (wraps around)
g Go to offset (hex 0x… or decimal)
G Go to end of file
s Save to original file
S Save as new file
q Quit (press twice if there are unsaved changes)

ASCII panel

Key Action
Printable keys Overwrite byte at cursor
Delete Delete byte at cursor
Ctrl-Z Undo last change
Ctrl-F Find byte sequence
Ctrl-N Find next (wraps around)
Ctrl-G Go to offset
Ctrl-S Save to original file
Ctrl-Q Quit (press twice if there are unsaved changes)

Notes

  • The entire file is loaded into memory. Files up to available RAM are supported.
  • Undo history is capped at 4096 operations per session.
  • Find wraps around to the start of the file if no match is found forward.
  • Byte input in the hex panel is always hexadecimal (type 41 for A, not 65).

About

Interactive terminal hex editor

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors