Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 10-13-2003, 04:13 PM   #1
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.

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

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

Rep: Reputation: 911Reputation: 911Reputation: 911Reputation: 911Reputation: 911Reputation: 911Reputation: 911Reputation: 911
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.

Old 10-13-2003, 04:19 PM   #4
LQ Newbie
Registered: Sep 2003
Posts: 4

Original Poster
Rep: Reputation: 0

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

Thanks again


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 > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:02 PM.

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