LinuxQuestions.org
Help answer threads with 0 replies.
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, 04: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, 04:15 PM   #2
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
Add that directory into your $PATH
 
Old 10-13-2003, 04:17 PM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,005
Blog Entries: 11

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
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, 04: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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 06:26 AM
Run/execute Kylix executable stormNC Programming 4 06-10-2004 03:44 PM
Why the executable file could not execute? jeson_515 Programming 3 03-14-2004 10:40 PM
Converting perl files to executable mac files mrozkan Programming 0 04-16-2002 10:56 AM
Executable Files Acar Linux - General 1 02-22-2002 11:59 AM


All times are GMT -5. The time now is 05:52 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration