LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Recognizing executables (https://www.linuxquestions.org/questions/linux-newbie-8/recognizing-executables-15297/)

tracey 02-28-2002 06:51 PM

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!!

neo77777 02-28-2002 06:53 PM

try ./a.out, it will instruct the system to execute the file a.out in current working directory.

neo77777 02-28-2002 06:56 PM

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).

pperon 02-28-2002 06:57 PM

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

isajera 03-01-2002 12:59 AM

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.

tracey 03-01-2002 10:23 AM

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!! :)


All times are GMT -5. The time now is 12:49 AM.