Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an executable file but don't know what type or format it is. When I execute like this

$chmod +x xfile

It shows

Permission denied

when I run as super user

$sudo ./xfile

It shows

sudo: ./xfile: command not found

I am new to Linux please tell me how to execute it.

share|improve this question
Try sudo sh /path/to/file/xfile – blade19899 Sep 18 '12 at 13:17
which type of executable is it? A python program, ruby or some binary ? – Pranit Bauva Sep 18 '12 at 14:05
You are doing the right process to run the file. Nevertheless, in certain cases you must use sudo chmod -x xfile in order to create the proper execution permissions over the file itself. In addition you must consider the location of the file. If it belongs to a different hard disk drive/partition or usb-memory/external-storage the command may not succed giving the proper permissions to the file for execution. Good luck! – Geppettvs D'Constanzo Sep 18 '12 at 15:15
Once I was in trouble because I forgot the extension of the file. Did you put it? – Michele Sep 23 '12 at 14:47

Strange, it works exactly that way over here.

First, try to find out what the file is:

file xfile

The file command looks inside the file and based on certain "magic" tries to figure out what that program does.

From what you describe I guess that it is a shell executable that tries to execute yet another program. If this is the case, why don't you post the code of the shell executable using

share|improve this answer

Had the same problem. In my case the executable was stored on a different drive which was why chmod+x was not working.

I copied the executable to a Linux directory (like Desktop), set the permissions using chmod+x, ran the executable using "./" and it worked :)

share|improve this answer
yes, probably because of the reason in my answer. – cat Jan 23 at 0:54

The problem is that unless the filesystem of the device is like ext3 or ext4, (and probably it is FAT32 for you), the filesystem does not store much metadata about files, including the executable bit.

When you do chmod +x yourfile, then ls -la yourfile, you will notice the executable bit has not in fact been set.

The solution here is to cp yourfile ~/yourfile; chmod +x ~/yourfile; ~/yourfile, because the filesystem on which your Linux is installed has executable permissions.

Learn more about the *nx permissions model.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.