How to run binary file in Linux

前端 未结 11 1032
执念已碎
执念已碎 2021-02-01 18:15

I have a file called commanKT and want to run it in a Linux terminal. Can someone help by giving the command to run this file? I tried ./commonRT but I

相关标签:
11条回答
  • 2021-02-01 18:17

    your compilation option -c makes your compiling just compilation and assembly, but no link.

    0 讨论(0)
  • 2021-02-01 18:26

    To execute a binary or .run file in Linux from the shell, use the dot forward slash friend

     ./binary_file_name
    

    and if it fails say because of permissions, you could try this before executing it

     chmod +x binary_file_name
     # then execute it
     ./binary_file_name
    

    Hope it helps

    0 讨论(0)
  • 2021-02-01 18:27

    The volume it's on is mounted noexec.

    0 讨论(0)
  • 2021-02-01 18:30

    :-) If not typo, why are you using ./commonRT instead of ./commonKT ??

    0 讨论(0)
  • 2021-02-01 18:31

    To execute a binary, use: ./binary_name.

    If you get an error:

    bash: ./binary_name: cannot execute binary file

    it'll be because it was compiled using a tool chain that was for a different target to that which you're attempting to run the binary on.

    For example, if you compile 'binary_name.c' with arm-none-linux-gnueabi-gcc and try run the generated binary on an x86 machine, you will get the aforementioned error.

    0 讨论(0)
  • 2021-02-01 18:33

    Or, the file is of a filetype and/or architecture that you just cannot run with your hardware and/or there is also no fallback binfmt_misc entry to handle the particular format in some other way. Use file(1) to determine.

    0 讨论(0)
提交回复
热议问题