Ubuntu Linux View, edit, compare binary files

Source: Internet
Author: User
Tags compare binary files

There are several ways to view the binary:

Method One: Hexdump

Apt-get Install Libdata-hexdumper-perl

After installation, you can hexdump the your_binary_file directly.

You can also use the HD command directly instead of Hexdump.

If you want to look slowly: HD Your_binary_file | More

Method Two:

Vim can be used to view and edit binary files

Vim-b Egenea-base.ko Plus-b parameter, open in binary

Then enter the command:%!XXD-G 1 switch to hexadecimal mode display

0000000:7f 4c 46 01 01 01 00 00 00 00 00 00 00 00 00. ELF .......
0000010:01 00 03 00 01 00 00 00 00 00 00 00 00 00 00 00 .......
0000020:2C A7 at xx, xx, xx, xx, xx, xx,....... 4 .....
0000030:10 0d, E5, 8b, C0 74 11 .... U.. Qq. e...t.
0000040:52 A1 (XX) E8 FC FF FF FF C4 RRP ..... P.......
0000050:10 5d C3 8d e5 B8 01 00 ...]... V.u. Pp...
0000060:00 8b D0, 8d, C0 d0 ..... U.9.s. V... 9.
0000070:72 FA 8b (A1)-E8 FC R. U.qrp ..... P..
0000080:FF FF FF, EC 5d C3 e5 B8 01 00 .......... U.. Pp...
0000090:00 8b D0, 8d, C0 d0 ..... U.9.s. V... 9.
00000a0:72 FA 8b 4d 8b ten-A1-xx xx M.. U.qrp .....
00000B0:50 E8 FC FF FF FF 5d C3 f6-e5 (.....) ... U.. W
00000C0:56-Bayi EC 8c (XX) 8b 5d 1c 8b [db] VS ...]. E...
00000d0:75 7e-C0 (8b) A1-u~. UQP.E.P .....
00000e0:68 8c xx E8 FC FF FF ff c4 C2 h .... P.........

You can then modify the 16-character characters as you would a text file, with/find the specified offset, and so on. Modifying the ASCII character to the right should not be valid. After the modification is done:%!xxd-r switch binary mode, then: Wq Save to exit. In this vim inside such editing is still very convenient, note must:%!xxd-r switch back after the save line.

Method Three. Linux also has 16 GUI tools for editing

Jeex (http://www.hds619.net/jeex.php)

Ghex

Bless (Bless is a Hex Editor for gtk# http://home.gna.org/bless/)

UltraEdit

Two binary comparisons can be made using Vimdiff.

Vimdiff should still be useful, similar to the Windows platform WinDiff

VIM-BD Base.ko Base2.ko

After opening, you can display two files in two windows.

CTRL + W +L switches the input focus to the right window, activates the right window and then enters the command for the right window.
:%!xxd-g 1 Switch to a 16-byte pattern of binary
CTRL + W +H switch the input focus to the left window
:%!xxd-g 1
] + C to find the last different point
[+ C finds the next different point
0012930:89 DF E8 FC Ff| 0012930:89 DF-E8 FC F

Transferred from: http://blog.csdn.net/chenqiai0/article/details/8537832

Ubuntu Linux View, edit, compare binary files

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.