how to read a executable file in linux

Discussion in 'Command Line' started by rajin43, Sep 26, 2012.

  1. rajin43

    rajin43 New Member

    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Hi,
    how to read the executable bin files in linux.i tried strings command.but that is not much useful.

    Regards
    Rajini

  2. WeAreGeek

    WeAreGeek Member

    Messages:
    38
    Likes Received:
    5
    Trophy Points:
    8
    strings displays all readable characters in a file. Likely in this case, there aren't (m)any.
    You might wanna try hexdump or od (octal dump).
  3. marikar

    marikar New Member

    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Code:
    hexdump -C filename|less
    the character between filename and less is an ascii pipe
  4. icyfight

    icyfight New Member

    Messages:
    11
    Likes Received:
    2
    Trophy Points:
    0
    executable file in linux may be a shell script, python script and so on. You can edit them in text editor.
    The most common executable files are binary files consist of zero and one.
    But there are still some spec in these files. You can find them by google.
  5. WeAreGeek

    WeAreGeek Member

    Messages:
    38
    Likes Received:
    5
    Trophy Points:
    8
    If the executable in question was a script, the strings command would have been rather useful indeed. However, the question was about an executable bin (binary) file.
  6. icyfight

    icyfight New Member

    Messages:
    11
    Likes Received:
    2
    Trophy Points:
    0
    I'm a java programmer, after compile the .java files, I get the .class files.
    The relationship between linux executable file and kernel is just like .class file and jvm.
    Jvm read the .class file and fetch the instructions and data form file, then execute the instructions.
    The .class file have its spec, so does the linux executable file.
    Follow this link:http://en.wikipedia.org/wiki/Executable_and_Linkable_Format
    If you know about the assembler, you may understand it.
  7. icyfight

    icyfight New Member

    Messages:
    11
    Likes Received:
    2
    Trophy Points:
    0
    You can use the hex editor to view the bin file.
    Like echo "hello" command in the shell script file , the hex string 0x0011 0x12FF in bin executable file may indicates to output the data to console(the 0x0011 represent the instruction, and the 0x12FF may be the address of the data in the memory).
    echo "hello"
    0x0011 0x12FF

Share This Page