If you compile programs or write shell scripts, it's good to put them in one directory. This can be a subdirectory of your home directory. Or, if several people want to use these programs, you could pick any other directory -- as long as you have write access to it. Usually, the directory's name is something like bin -- though I name mine .bin (with a leading dot) to keep it from cluttering my ls listings.
For instance, to make a bin under your home directory, type:
% cd % mkdir bin
Once you have a directory for storing programs, be sure that the shell can find the programs in it. Type the command echo $PATH and look for the directory's pathname. For instance, if your directory is called /u/walt/bin, you should see:
% echo $PATH ...:/u/walt/bin:...
If the directory isn't in your PATH, add it in your .profile or .cshrc.
If other people are using your bin directory, use a command like chmod go+rx bin to give them access. If you're concerned about security, prevent unauthorized users from adding, removing, or renaming files in your directory by making sure that only you have write access; you can do this with a command like chmod go-w bin. Also be sure that individual files can't be edited by people who shouldn't have access to the files.
When you add a new program to your bin directory, if you use the C shell or a C-shell derivative, you need to use the shell's rehash command to update its command search path.
-- JP
Copyright © 2003 O'Reilly & Associates. All rights reserved.