hexedit
Edit binary files in hexadecimal
TLDR
Open file
Display file with sectors
Maximize file display
Display help
SYNOPSIS
hexedit [options] [filename]
PARAMETERS
-s, --scrollbar
Shows the scrollbar on the right side of the display.
-b N, --bitsperblock=N
Sets the number of bits to display per block (1-8). Default is 8.
-c, --colors
Uses colors for the display (this is the default behavior).
-C, --nocolors
Disables the use of colors for the display.
-d, --dump
Dumps the file content to standard output in hex/ASCII format and then exits.
-e, --ebcdic
Uses the EBCDIC character set for the text representation instead of ASCII.
-f, --force
Forces hexedit to open the file, even if there are issues.
-o OFFSET, --offset=OFFSET
Sets the initial offset in the file from which to begin viewing or editing. Accepts decimal, hexadecimal (e.g., 0x100), or suffixed values (e.g., 10k, 5m).
-r, --readonly
Opens the specified file in read-only mode, preventing any modifications.
-V, --view
Enables view mode, which is equivalent to enabling both --readonly and --noscroll options.
-v, --version
Displays the hexedit version information and then exits.
DESCRIPTION
hexedit is a full-screen, interactive utility designed for viewing and editing files in their raw hexadecimal, octal, and ASCII (or EBCDIC) representations. It provides a highly visual interface, similar to a text editor, allowing users to navigate through file contents byte by byte. This makes it invaluable for tasks such as analyzing binary file formats, reverse engineering, patching executables, recovering data, or simply inspecting non-textual data.
Users can easily switch between different display modes, jump to specific offsets, search for patterns, and perform byte-level modifications directly within the terminal, making it a powerful tool for low-level file manipulation.
CAVEATS
Directly editing binary files, especially system files or executables, can lead to file corruption or system instability if not done correctly. Always back up files before making modifications with hexedit. Be cautious of byte order (endianness) when interpreting multi-byte values, as hexedit displays bytes sequentially without assuming a specific endianness for multi-byte values.
INTERACTIVE COMMANDS
hexedit operates interactively within the terminal, offering a range of keyboard commands for navigation and editing:
Arrow keys, PgUp/PgDn: Navigate through the file.
Tab: Switch between the hexadecimal and ASCII/EBCDIC editing panes.
Ctrl+S: Search for a string or hexadecimal sequence.
Ctrl+F: Find the next occurrence of the search pattern.
Ctrl+R: Initiate a replace operation.
Ctrl+G: Go to a specific absolute offset in the file.
Ctrl+X, then Ctrl+C: Save changes and exit.
Ctrl+C (on its own): Exit without saving (if not prompted for save).
F1 or Ctrl+H: Display the in-program help.
When editing, typing in the hexadecimal pane directly modifies bytes (two characters per byte), while typing in the ASCII pane modifies the corresponding characters.
DISPLAY MODES
By default, hexedit typically displays three main columns: the file offset, the hexadecimal representation of bytes, and the ASCII (or EBCDIC) representation of those bytes. An octal representation may also be shown if the terminal window size permits. Users can configure column widths and disable various display elements like headers, footers, or scrollbars via command-line options or interactive settings.
HISTORY
hexedit emerged as a dedicated full-screen hexadecimal editor for command-line environments, complementing simpler dumping tools like od and xxd. Its development aimed to provide an intuitive, interactive interface for low-level file manipulation, drawing inspiration from traditional text editors to enable direct navigation, search, and modification of binary data within the terminal. It has been a staple utility in Linux and Unix-like systems for decades, evolving to include features like color support and various display options.