LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
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 07-14-2005, 11:04 PM   #1
lyar1031
Member
 
Registered: Jul 2004
Posts: 54

Rep: Reputation: 15
Running executables in Red Had


I am kind of new to Linux. I am running Red Hat 8.0.

To run a executable you type ./<file> Is there a way where you can run the executable by just typing the file name.

For example:
./a.out ----> a.out

Thanks
 
Old 07-14-2005, 11:32 PM   #2
nadroj
Senior Member
 
Registered: Jan 2005
Location: Canada
Distribution: ubuntu
Posts: 2,539

Rep: Reputation: 58
yes there is a way to do this.
the './' in './<filename>' means to look in the current directory (.) and execute the file. when you run commands like 'ls' or 'man' the reason you dont have to specify their full path is because the computer knows where it is. there is a environment variable when your logged in called $PATH. the computer (shell) knows about this variable, and inside the variable is a list of paths to folders where the computer will look when you run commands. when you run a command like 'ls', the path to that is stored in this variable, and the shell checks the list of variables looking for the file/command (ls) and then knows how to execute it/where it is.
you can view your current path variable by typing 'echo $PATH', i believe, at the console. the list is colon delimited.. meaning its a long list and each entry is seperated by colons.
search yahoo or google for how to modify your path variable, if need be.

i read in a linux book i had last year for school that if you put your current path (.) in the $PATH variable it is a security risk.
if its just one filename/path you want to add then, read up about how to add it, and try it! but dont put '.' in the path variable.
 
Old 07-14-2005, 11:35 PM   #3
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 118Reputation: 118
If you just want to type the filename, then you need to have that directory in your PATH. To see your current path and add a new directory: (edited for brevity)
Code:
$ echo $PATH
/bin:/usr/bin:/usr/local/bin
$ PATH=$PATH:/opt/utilities
$ echo $PATH
/bin:/usr/bin:/usr/local/bin:/opt/utilities
I could now run programs located in /opt/utilities just by name.
 
  


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
Running other executables from my app unholy Programming 3 07-31-2004 10:52 AM
Running executables Dill Linux - Newbie 4 04-22-2004 01:32 PM
Can anyone running Red Hat 9 show me... LinuxQuestions Linux - Newbie 1 03-23-2004 11:34 AM
Running Bryce in Red Hat 8.0 Jono Linux - Software 4 10-14-2002 02:02 AM
Problems running executables in RH 7.2 oudent Linux - Newbie 1 11-20-2001 10:14 AM


All times are GMT -5. The time now is 05:37 PM.

Main Menu
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