[Techtalk] Executing user-made commands on the command line
Alain Tesio
alain at onesite.org
Sun May 11 14:19:33 EST 2003
On Sun, 11 May 2003 04:55:08 -0700 (PDT)
Berenice <showercurtain2000 at yahoo.com> wrote:
> 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.
It depends of the command. Most basic binaries come from gnu.org.
Whatever your distribution is, Debian repository is a good starting point
to get source files, at this url:
http://www.debian.org/distrib/packages
Type the name of the file in the section "search contents" (bin/ls to get
less matches than just ls)
Then you see the file in the package fileutils, and from the package page
you can download the source tarball (not modified by Debian) :
http://ftp.debian.org/debian/pool/main/f/fileutils/fileutils_4.1.orig.tar.gz
> 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)?
Your executable file must be in your path:
"echo $PATH" to see it
"export PATH=~/bin:$PATH" to insert a new directory at the start of your path
Put this in ~/.bashrc (or similar depending of your shell) to make it permanent.
Usual directories are /usr/local/bin (system-wide) or ~/bin (each user)
Alain
More information about the Techtalk
mailing list