Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 11-14-2008, 06:20 PM   #1
LQ Newbie
Registered: Nov 2008
Posts: 2

Rep: Reputation: 0
compile fortran using g77 into executable binary image

Hi all,

I am kind of new to fortran Unix (and other OS)
I am compiling a source say abc.f
$g77 -o abc abc.f
By then, I have an executable abc binary file
After that, I change the mode of abc into executable
chmod 775 abc

In order to run the image, I must type
$./ abc

I am very very new to Unix/Linux, please anyone could teach me how to convert this binary image into some "executable image" that can run without "./". I just want to type abc then the abc program will be called.

Thanks and regards,
Have a good day everyone!

Last edited by tuas; 11-14-2008 at 06:23 PM.
Old 11-14-2008, 07:59 PM   #2
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,541
Blog Entries: 15

Rep: Reputation: 1488Reputation: 1488Reputation: 1488Reputation: 1488Reputation: 1488Reputation: 1488Reputation: 1488Reputation: 1488Reputation: 1488Reputation: 1488
In UNIX/Linux executables are searched for based on the PATH variable.

The PATH variable has a series of directories separated by colon. You can see what your PATH is currently defined as by typing:
echo $PATH

You should see something like:

When you type "abc" it looks in the directories in the order they appear in your PATH. So it would first look for /bin/abc then /usr/bin/abc and finally in /usr/local/bin/abc.

When you type "./" you're saying "this directory" so you COULD simply add it to PATH by typing:

But really "." is a short cut to current directory so you COULD simply add it to PATH by typing:

However that you should NOT do either of those for security reasons. What you should do is put abc in a directory you use for that purpose then add that directory in your path.
For example if "./" were your home directory (/home/<yourusername>) then you might want to do:

Many people prefer to have separate bin subdirectory so you might want to instead type:
mkdir /home/<yourusername>/bin

You can make the change permanent by editing your .bashrc or .bash_profile file.

Typing "man bash" will give you a wealth of information about many subjects including the standard variables like $PATH, $HOME etc...
Old 11-21-2008, 11:03 AM   #3
LQ Newbie
Registered: Nov 2008
Posts: 2

Original Poster
Rep: Reputation: 0
Hi jlightner,
Thank you very much for your reply. It works 100%..
I am very happy now..



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
g77 in gcc 4.1.0 not found only gfortran fortran 95 compiler! I need fortran 77. TheBrick Linux - Software 3 07-04-2007 07:39 AM
Compiling Fortran program by g77 akillam Linux - Software 1 10-16-2006 06:02 AM
Compiling with g77 thank you very much...but I solved compile with g77 gambato79 Fedora 9 07-19-2005 12:35 PM
compile( gcc-g77) fortran with fedora core 3 gambato79 Programming 1 05-06-2005 01:49 PM
G77 Fortran included in Fedora 2 ? aeslin Linux - Software 1 11-08-2004 08:27 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:43 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