Linux command
hexedit 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Open a file
hexedit [path/to/file]
Open in read-only mode
hexedit -r [path/to/file]
Open with a specific sector size
hexedit -s [512] [/dev/sda]
Open without showing ASCII column
hexedit --nocolor [path/to/file]
说明
hexedit is a terminal-based hex editor for viewing and editing binary files at the byte level. It displays file contents in hexadecimal alongside ASCII representation, allowing direct modification of individual bytes. The interface shows three columns: byte offset on the left, hexadecimal values in the middle, and ASCII characters on the right. Pressing Tab switches between editing hex values and ASCII characters. Modified bytes are highlighted. Navigation is efficient for both small files and large binaries (or even block devices). The Ctrl-G command accepts offsets in hex (prefix with 0x) or decimal. Search works for both hex patterns and ASCII strings. For disk editing, the sector size option (-s) affects how the editor handles reads and writes. Changes to block devices require appropriate permissions and extreme caution. hexedit uses a simple memory model - changes are held in memory until explicitly saved. The Ctrl-U command reverts all unsaved changes. For large files, it memory-maps the file for efficient access.
参数
- -s, --sector _size_
- Set sector size for disk editing (default: 512).
- -r, --readonly
- Open file in read-only mode.
- -h, --help
- Display help information.
- --nocolor
- Disable color output.
FAQ
What is the hexedit command used for?
hexedit is a terminal-based hex editor for viewing and editing binary files at the byte level. It displays file contents in hexadecimal alongside ASCII representation, allowing direct modification of individual bytes. The interface shows three columns: byte offset on the left, hexadecimal values in the middle, and ASCII characters on the right. Pressing Tab switches between editing hex values and ASCII characters. Modified bytes are highlighted. Navigation is efficient for both small files and large binaries (or even block devices). The Ctrl-G command accepts offsets in hex (prefix with 0x) or decimal. Search works for both hex patterns and ASCII strings. For disk editing, the sector size option (-s) affects how the editor handles reads and writes. Changes to block devices require appropriate permissions and extreme caution. hexedit uses a simple memory model - changes are held in memory until explicitly saved. The Ctrl-U command reverts all unsaved changes. For large files, it memory-maps the file for efficient access.
How do I run a basic hexedit example?
Run `hexedit [path/to/file]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -s, --sector _size_ do in hexedit?
Set sector size for disk editing (default: 512).