LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
::Linux Guide
::Tips
::Connections
::Alternatives
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: New Users :: Beginners Linux Guide :: Setting up the Executable Path


Going back to the days of DOS, if you wanted to run a program from the command line that resided in a directory other than the current one, you had two choices. Either supply the full path to the program, eg: c:\windows\command\qbasic.exe, or add the location of the program to your system "Path". Each time you enter a command to run an application, the computer first searches in your current directory for it, and then in the path, before running it, or returning a "File not Found" error. The same is true for Linux. Ideally we could place every directory on the Hard Disk in the path, but this would be ridiculous. The computer would take an age searching through your hard disk trying to find it!

A simpler solution was thought up a few years back. Put all the programs you are going to use into one directory, and add that directory to the path. An example of a directory in the path is "/usr/bin" ... this is where little programs like 'ls' and 'vi' are kept. The one where anything you add, after installing Linux, is "/usr/local/bin". The bin in each case refers to "Binaries", or programs you can run. I found after my Installation of RedHat 5.0 (Im running 5.1 now), that /usr/local/bin wasn't in the path. So after a quick consultation with a friend, heres how we worked it out :

  • From the command line, type vi /etc/profile
  • About 5 lines down, the locations of the path are present. To add another one, just go to the end of that line before the inverted commas, put a colon in, and then type the full path of the directory you want to add
  • Save the file and exit
  • Go out on the beer to celebrate

And thats it. Its really quite easy when you think about it, unfortunately no one tells you what all the files in /etc/ do, you just have to learn them as time goes on ...




You may find the following helpful:
Learn more about vi
Syntax highlighting in ViM, mappings and the vimrc file
Using vi
Vi filters, search & replace and more...
ViM: Variable/Word completion, indenting, macros and function navigation.


About the author, Owen Kelly.

USERS COMMENTS
Posted By David Faultersack 01:13, 7 March 2005
Rather than adding the path for each working directory, use a single "." (period) so scripts can be called from any current directory (when the current directory is not in the path).
Cheers.


                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell