UNIX has utilities like
to look for
a command on the system.
doesn't look in your shell's search path, so it
may not find shell scripts in local system directories or your
And to use which
, you have to know the exact name of the command,
only shows the first command with that name in your path.
If you're like me, you can't always remember the name of the command
you're looking for.
"Wasn't it called reference
or something like that?"
script saves me a lot of guessing.
It shows all command names, in all directories
in my search path, that contain some string.
So, I'll look for command names that have "ref" in them:
||After a couple of tries, I usually find the command I want.
script is on the CD-ROM.
First, the script edits a copy of your
to change any current directory entry to a dot (
Next, a colon (
) in the
variable lets the shell split the PATH
at the colons;
steps through each directory in the PATH
and runs ls -l
to find matching files.
script reads through the output of all the ls
commands in the loop, editing and printing matching lines (executable files with
the program name we want).