LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 02-28-2002, 07:51 PM   #1
tracey
LQ Newbie
 
Registered: Feb 2002
Distribution: RedHat 7.2
Posts: 14

Rep: Reputation: 0
Recognizing executables


Hi -

My new Linux system sometimes does not recognize executables, and I'm not sure what to do.

For example, I am using fortran77, and just wrote a test "hello world" type program. I compiled it, and get an executable, "a.out" When I type "ln -l" for the file, it definately has executable priveledges. However, when I type "a.out" on the command line I get "command not found." This occurs no matter what I name the compiled program.

As a test, I tried compiling the exact same code in the exact same way on an established linux server. It works perfectly. There are other differences between this other system (hereafter called "the good system") and mine.

* on the good system, all exectuables are denoted by an asterisk (e.g. a.out*)

* on the good system, all directories are denoted by a slash (e.g. mydir/)

* on the good system, each file type shows up in a different color.

How can I get these cosmetic changes, too?

And, more importantly, do you have any ideas on why my little test executables aren't executing?

Thank you!!
 
Old 02-28-2002, 07:53 PM   #2
neo77777
LQ Addict
 
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

Rep: Reputation: 56
try ./a.out, it will instruct the system to execute the file a.out in current working directory.
 
Old 02-28-2002, 07:56 PM   #3
neo77777
LQ Addict
 
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

Rep: Reputation: 56
And to make the commands resided in the current working directory to be executed from the current working directory, edit your PATH environment variable to include current working directory, open /home/yourusername/.bash_profile file for editing and append at the end of PATH statement
:. ( it is a colon followed by a dot).

Last edited by neo77777; 02-28-2002 at 07:57 PM.
 
Old 02-28-2002, 07:57 PM   #4
pperon
Member
 
Registered: Jan 2002
Location: Cleveland
Distribution: Gentoo and umm... Gentoo
Posts: 64

Rep: Reputation: 15
When you just type in the name (ie. hello) the shell will search your $PATH looking for the command 'hello' (to see exactly what it's searching, type 'echo $PATH'). Therefore you must explicitly tell it where it needs to look. In your case you would 'cd' into the directory which contains your file and type, './hello'.

-p
 
Old 03-01-2002, 01:59 AM   #5
isajera
Senior Member
 
Registered: Jun 2001
Posts: 1,635

Rep: Reputation: 45
ummm... just one small thing -

if the shell doesn't find the prog when you're in the directory, that either means that your user's enviro variables weren't set very well, or that you're compiling and running this program as root.

for security reasons, root does not have the current directory in it's path, and it's a really bad idea to add it. this opens the door for trojans and other bad whatnots. it's not a serious issue on a desktop system at your home, but it's a good habit to learn to separate root work and regular user work.
 
Old 03-01-2002, 11:23 AM   #6
tracey
LQ Newbie
 
Registered: Feb 2002
Distribution: RedHat 7.2
Posts: 14

Original Poster
Rep: Reputation: 0
Great advice!

Changing the PATH specification worked perfectly (and I'm happy to know what specifying the PATH does... slowly I'm learning...)

(Also, good to know that I'm not supposed to be able to run programs as root.)

Thank you!!
 
  


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
Recognizing CD-writer under 2.4.22 svar Slackware 2 12-01-2004 02:02 AM
executables humblestudent87 Linux - Newbie 6 07-22-2004 12:42 PM
not recognizing modem mikescar Linux - Newbie 4 03-02-2004 05:32 PM
Help on executables.... Kit Linux - General 9 12-06-2002 12:24 PM
Where are the executables? rooman Linux - Software 6 06-05-2002 03:31 PM


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