Help answer threads with 0 replies.
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 07-14-2005, 11:04 PM   #1
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

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

Rep: Reputation: 60
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
LQ Guru
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 125Reputation: 125
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)
$ echo $PATH
$ PATH=$PATH:/opt/utilities
$ echo $PATH
I could now run programs located in /opt/utilities just by name.


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

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