Misc. commands, was Re: Nothing works on Red Hat

ghaverla@freenet.edmonton.ab.ca ghaverla@freenet.edmonton.ab.ca
Sun, 1 Dec 2002 10:05:49 -0700 (MST)


> > Can you tell me where these things are stored? Is it somewhere under 
> > /tmp/ or god knows where?

People coming from Windows (I'm not sure if Mac has a similar
thing) may have had occasion to use a command called "find".
UNIX (including Linux) has a command of that name, which can
do zillions of things.  A common thing, is to recursively search
part of the file structure, looking for a specific file name.
Looking for a file pattern can also be done.  However, just like 
the Windows version, it can be a little slow.

A while ago, the find package on most Linux systems acquired a
couple of helper programs, locate and updatedb.  Updatedb was
usually run by a 'cron' job, and it would cache all the file
names currently on the system.  The locate command would access
this cache (database) of file names.  The updatedb command
usually runs on startup, or during the middle of the night.
But, if need be 'root' could run the command manually so that
locate has current information to use.

> ..gnucash under your home directory.  You won't see it if you just do a standard
> ls.  You'll need to include the -a switch for it to show up.  You ought to be
> able to simply remove the whole thing.

Locate will find yours (and possibly everyone elses .gnucash),
along with its contents.

 locate .gnucash | less

We are piping the results in the 'less' pager, so that we don't
just see the last 20 results.

Instead of deleting the .gnucash directory, you might just
rename that directory (with the mv (or move) command).  This way,
you don't lose anything inadvertently.  But, if you don't know how
to find specific stuff within the .gnucash directory, deleting
has the advantage that you won't forget to remove this stuff later
on.

Some versions of locate will only let you look for filenames
you have permission to see, the filenames you might see using
the less command.  Root can, of course, view all filenames
present on your system.  On my system, I have almost 600,000
filenames cached, which demonstrates why it can take a while
to "find" a specific filename using something like:

 find / -name "Name_to_look_for" -print

Another command, which is in a sense related, is the 'which'
command.  It looks down your currently defined PATH, to
try and locate the executable program with the name you
give it.

For example:

  which sh

responds

 /bin/sh

If you get no response, the command cannot be found on your
PATH.  So, if someone tells you to use a certain command,
and you keep getting error messages from the shell, you might
want to try the which command to see if it is on your PATH
and the locate command to see if it is on your computer somewhere
(but not on your PATH).  You may need to do this as root.

Gord