[Techtalk] Executing user-made commands on the command line

Hamster hamster at hamsternet.org
Sun May 11 14:14:59 EST 2003


Berenice,

> May as well post some more questions while I'm here :)
> 1.  Where I can see the source code of commands such as ls or rm? 
> I'm interested in seeing how they do things like flow control and
> options.

If you tell me which distro youre using I can give a far more precise
answer, but the vague version of the story is to use your distro's package
management system to find out which packages provide the programmes ls and
rm. Then download the source for those packages, and there you have it.

You could also have a hunt through the www.gnu.org website for "pure"
source.

> 
> 2. If I create my own commands, how can I make them run like standard
> linux commands (ie: just by tying in the command name at the prompt)?

Just put the binary in a directory in your path. This could be somewhere
like /usr/bin .
To find out what directories are in your path run
echo $PATH
at the command prompt. 

Hamster



More information about the Techtalk mailing list