cannot execute binary file

I have a simple binary file needs to be executed. So I opened terminal and navigate to the folder where the binary file is. Then I gave the command ./bclock and got the following error,

-bash: ./bclock: cannot execute binary file

After some research I though it has something to do with echo $PATH. Can someone help me out?


Solution 1:

The two common problems are that the permissions are wrong or the file is somehow corrupt.

You can add execute permission (or list them) with the two commands:

chmod a+x ./bclock
ls -l ./bclock

You can check the file format as well to see if it's really executable or if it's a script or other type.

file ./bclock