LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-13-2003, 03:13 PM   #1
brady9953
LQ Newbie
 
Registered: Sep 2003
Posts: 4

Rep: Reputation: 0
Question Cannot execute executable files without ./


Hi all, I am trying to write some small programs in C for the first time. The problem is:

When I have compiled the C source code to obtain an executable file I cant run it by simply typing its name when im in the directory where it is stored. I can only get it to execute using ./[some file name]. Is there anyway to get the executable to run by simply typing the name of the file when Im in the directory.

Example hello is an executable file that can only be run by typing ./hello even when Im in the directory where it is stored but I cannot simply type hello

Any help would be most appreciated.

Regards
 
Old 10-13-2003, 03:15 PM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Add that directory into your $PATH
 
Old 10-13-2003, 03:17 PM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
If you are user root that behaviour is default, and,
for safety reasons, should not be changed. Just imagine
someone putting an executable named ls in /tmp.

If you're a normal user, just put . in your path.

Cheers,
Tink
 
Old 10-13-2003, 03:19 PM   #4
brady9953
LQ Newbie
 
Registered: Sep 2003
Posts: 4

Original Poster
Rep: Reputation: 0
Thanks

Cheers, most appreciated - Its more a personal annoyance than anything else!

Thanks again
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script to execute my c executable cranium2004 Programming 2 04-06-2005 05:26 AM
Run/execute Kylix executable stormNC Programming 4 06-10-2004 02:44 PM
Why the executable file could not execute? jeson_515 Programming 3 03-14-2004 09:40 PM
Converting perl files to executable mac files mrozkan Programming 0 04-16-2002 09:56 AM
Executable Files Acar Linux - General 1 02-22-2002 10:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration