Linux bin file editor

How do I edit the binary or hexadecimal data of a file in Ubuntu?

Disclaimer: This is not the same as What are some good GUI binary viewers/editors?. How do I edit the binary data of a file in a gedit like editor? Eg:

I do not want one editor with both. I want two different editors. I have looked a GHex and it is not what I want.

Look into Bless hex editor (for GNOME) or ncurses-hexedit, hexer, or hexcurse (for console)

bless , hexedit , ncurses-hexedit , hexer , and hexcurse are the names of packages available in the Ubuntu software repositories. To install any of them, open a terminal window (alt—ctrl-T) and type sudo apt install bless (replacing bless with the name of your desired program)

1 Answer 1

You can use vim which should already be installed.

Just to make sure, go ahead and install vim:

sudo apt-get update sudo apt-get install vim 

Now, use the vim command :%! xxd -b to edit binary like in this example:

note: you can drag and drop the file into the terminal to automatically fill in the path for you

FYI, the :%! command prefix allows you to pipe the current file’s contents to command’s stdin, and replaces the file’s contents with command’s stdout. xxd is a linux command.

Once the file is open, press ESC and then type :%! xxd -b and then press ENTER .

Alternatively, you can add the flag -g4 to group the bits into 32 bit packets like :%! xxd -b -g4

Читайте также:  Hashcat install kali linux

enter image description here

For hex edit, use the vim command :%! xxd instead or :%! xxd -g4

d

Press ESC and then i for «INSERT» mode which allows you to edit.

Press ESC and then type :w followed by ENTER to save the file.

Press ESC and then type :q followed by ENTER or ESC and then type :q! followed by ENTER to exit the file.

Vim takes some getting used to but is really great once you take the time to learn how it works.

Additionally, vim allows you to edit just about anything including sqlite and all kinds of other stuff.

Also, when you convert a binary to hex and then edit, I think you may need to convert back to binary by using :%! xxd -r command as described here.

A very similar editor is bvi . Run the following command to install:

Источник

Top Hex Editors for Linux Systems

Hex editor lets you view/edit the binary data of a file – which is in the form of “hexadecimal” values and hence the name “Hex” editor. Let’s be frank, not everyone needs it. Only a specific group of users who have to deal with the binary data use it.

Let me give you an example if you have no idea what it is. Suppose you have the configuration files of a game; you can open them using a hex editor and change certain values to have more ammo/score, and so on. To learn more about Hex editors, you should start with the Wikipedia page.

In case you already know what’s it used for – let us take a look at the best Hex editors available for Linux.

Читайте также:  X86 64 linux gnu libc so 6

Note: The hex editors mentioned are in no particular order of ranking.

1. Bless Hex Editor

bless

Key Features:

  • Raw disk editing
  • Multilevel undo/redo operations.
  • Multiple tabs
  • Conversion table
  • Plugin support to extend the functionality

Bless is one of the most popular Hex editor available for Linux. You can find it listed in your AppCenter or Software Center. If that is not the case, you can check out their GitHub page for the build and the instructions associated.

It can easily handle editing big files without slowing down – so it’s a fast hex editor.

2. GNOME Hex Editor

ghex

Key Features:

Yet another amazing Hex editor – specifically tailored for GNOME. Well, I personally use Elementary OS, so I find it listed in the App Center. You should find it in the Software Center as well. If not, refer to the GitHub page for the source. For Ubuntu-based distros, install it using the command below:

You can use this editor to view/edit in either hex or ASCII. The user interface is quite simple – as you can see in the image above.

3. Okteta

okteta

Key Features:

  • Customizable data views
  • Multiple tabs
  • Character encodings: All 8-bit encodings as supplied by Qt, EBCDIC
  • Decoding table listing common simple data types.

Okteta is a simple hex editor with not-so-fancy features. Although, it can handle most of the tasks. There’s a separate module of it that you can use to embed this in other programs to view/edit files.

Similar to all the above-mentioned editors, you can find this listed on your AppCenter and Software center as well. Install it on Ubuntu-based distros using the following command:

Читайте также:  Linux установка сертификата crt

4. wxHexEditor

wxhexeditor

Key Features:

  • Easily handle big files
  • Has x86 disassembly support
  • Sector Indication on Disk devices
  • Supports customizable hex panel formatting and colors.

This is something interesting. It is primarily a Hex editor, but you can also use it as a low-level disk editor. For example, if you have a problem with your HDD, you can use this editor to edit the sectors in raw hex and fix them.

You can find it listed on your App Center and Software Center. If not, Sourceforge is the way to go.

For Ubuntu-based distros, install it using the command below:

sudo apt install wxhexeditor

5. Hexedit (Command Line)

hexedit console

Key Features:

If you want something to work in your terminal, you can install Hexedit. It’s my favorite Linux hex editor in the command line.

When you launch it, you will have to specify the file’s location, and it’ll open it for you.

To install it, just type in:

Wrapping Up

Hex editors could come in handy to experiment and learn. If you are experienced, you should opt for the one with more features – with a GUI. Although, it all comes down to personal preferences.

There are other tools related to hex operations. Take xxd for example, you can use it to convert hex to ASCII in the Linux command line.

What do you think about the usefulness of Hex editors? Which one do you use? Did we miss listing your favorite? Let us know in the comments!

Источник

Оцените статью
Adblock
detector