Jump to content

Editing a Unix executable file

5 posts in this topic

Recommended Posts

Is it that you have a file which the system is listing as an "Unix executable file" and you don't know what it is?


When you open it in the hex editor, what are the first 8 hexbytes? (Often the initial bytes in the file will identify what type of file it is... for instance, if you see RIFF its most likely an AVI container for video or audio.)

Link to comment
Share on other sites

Does anyones know how I can edit this kind of file?


Um, you don't. You should tell us more about this file, but

basically there are two things you can do:


Find the source code for the executable, edit it, recompile; or

use "sed" to fix minor problems.


What am I talking about? sed is the stream editor that comes

with unices. You can do some minor fixes with it like what I

did some time ago. I had a file that was built to link to an older

version of libstdc++. It wanted, but could not find, libstdc++-5

on my system. I had libstdc++-6. So I did something like this:


sed -e 's@libstdc++-5@libstdc++-6@g' execfile > newexecfile


Since the libraries to which an ELF (unix exec) file link are written

in the file in ASCII, this substitution worked. Don't forget the "g"

near the end of the sed command, since that means to replace all

of the occurences, not just the first one. The executable ran just

fine after that.


Since I'm just showing off, you should probably just find the source

code or contact the author of the program.

Link to comment
Share on other sites


  • Create New...