Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can you recommend a hex editor that can be run from shell? I need to be able to edit not only view the content.

share|improve this question
I think you can do it using vim – Deepal Sep 12 '13 at 13:00
up vote 12 down vote accepted

emacs has a hexl-mode for hex editing.

share|improve this answer
hexl-mode isn't suitable for large files or disk partitions, since it loads the whole file into an emacs buffer. It's great for small files if you're already comfortable with emacs. – Peter Cordes Feb 15 '15 at 23:36
@PeterCordes, for editing a disk, simply dd the region you want to edit into a file and open that in emacs, then dd it back. – psusi Feb 17 '15 at 15:21
@psusi The problem is, I shouldn't have to go to that effort to edit a file – Cole Johnson Nov 11 '15 at 3:54
@ColeJohnson, we aren't talking about editing a file; we're talking about editing an entire raw hard disk. – psusi Nov 11 '15 at 23:15
@psusi On my Windows machine, I can use HxD and open up a disk just like any other file. – Cole Johnson Nov 15 '15 at 6:54

There is also DHEX

apt-cache show dhex

ncurses based hex editor with diff mode

This is more than just another hex editor: It includes a diff mode, which can be used to easily and conveniently compare two binary files. Since it is based on ncurses and is themeable, it can run on any number of systems and scenarios. With its utilization of search logs, it is possible to track changes in different iterations of files easily.

If you are not familiar with vim or emacs, this one doesn't seem to have much of a learning curve.

share|improve this answer



This tool is the most commonly available I have found for this type of task. You can remove the ascii readable part on the right if needed using -p and you can revert (change ascii input to binary data) using the -r function. Here are some simple example uses:

Converting to hex with ascii view:

echo example|xxd

Converting to a hexdump (no ascii view on the right):

echo example|xxd -p

Converting from a hexdump back to binary data:

echo 746573740a|xxd -p -r

You can get much more complex with this in shell scripts. I have actually used this and "dd" to scan for specific sequences and modify them in a predefined fashion all from a shell script using nothing but bash, dd, and xxd. You actually don't need dd for this either as you can "seek" to a specific location and write to that location the byte sequence you need. The biggest advantage to this approach is its easily scriptable.

share|improve this answer

You might be able to use vi as a hex editor too (it can call xxd). Here is a link to the info.

Using vi as a hex editor

share|improve this answer

Try hexed, it's made for use in scripts and make files.

share|improve this answer

Bless Hex Editor is a is a binary (hex) editor and currently provides the following features:

  • Efficient editing of large data files and block devices.
  • Multilevel undo - redo operations.
  • Customizable data views.
  • Fast data rendering on screen.
  • Multiple tabs.
  • Fast find and replace operations.
  • A data conversion table.
  • Advanced copy/paste capabilities.
  • Highlighting of selection pattern matches in the file.
  • Plugin based architecture.
  • Export of data to text and html (others with plugins).
  • Bitwise operations on data.
  • A comprehensive user manual.

You can dounload it from here:

To install it, see How to install a .deb file via the command line?

Need more?

share|improve this answer
The question is asking for a command line editor. – psusi Sep 12 '13 at 13:39
@psusi No, the OP asked about a hex editor that can be run from shell, not inside shell/terminal. It can be run from shell using bless command after is installed. – Radu Rădeanu Sep 12 '13 at 14:05
There is nothing you can not run from the shell; he wouldn't have mentioned it unless he meant command line. – psusi Sep 12 '13 at 17:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.