Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

No such file or directory - yet, file is there

Status
Not open for further replies.

southbeach

Programmer
Jan 22, 2008
879
US
hello!

What would cause Linux (Ubuntu) to emit an error "No such file or directory" when attempting to execute a file that is listed when using ls -l?

Command file [FILE-NAME] also finds the file and defines it as executable ... I just cannot execute it.


Thanks,




--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
Assuming you're doing this from a command prompt are you preceeding the filename with a "./"? Unless the current directory is defined in the path one must explicitly provide the path to the current directory. Therefore filename would be executed as ./filename
Also, when look at the output of ls -l filename is the file executable? You could try that with the
"sh ./filename " command.

Good luck
 
from command prompt
logged in as root ( I unlocked it )
using ./[FILENAME] or just [FILENAME] same error
sh ./[FILENAME] gives me Syntax error: "(" unexpected (no idea why this would be, it is not a plain text script)
file mode is 755





--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
The 'No such file or directory' could be output from your command. It could be running fine. Is it maybe not finding a file it needs?

If it's not finding the command itself, bash would give you this as output...

Code:
$ my_command
bash: my_command: command not found
$

Other shells give similar output.

The '(' unexpected is common when trying to run a compiled program as a parameter to a script. That just means it's not a script and you can't run it that way.

Try using the '[tt]strace[/tt]' command to see what file(s) it's trying to open. Something like this maybe...

Code:
$ strace my_command

See [tt]strace[/tt] man page for more info.
 
Firstly it would help to know what the file is, where it came from and how you are calling it?

Is it the correct version for your OS 32bit or 64bit?

Lets see the actual output from when you try and run it we may recognise the problem.

As Sam says above use strace to identify exactly what its doing it will help to use the -o option to push the results to a file and let us see here so we can help.

Good luck
L.
 
try ls -la
my first guess is that it is a symbolic link to a non-existent file

(ln -s does not check the destination exists when it creates the link)

A Maintenance contract is essential, not a Luxury.
Do things on the cheap & it will cost you dear
 
This will give you all the "open"s and their results...

Code:
strace my_command 2>&1 | grep open


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top