[CLUE-Tech] hostname

David Anselmi anselmi at americanisp.net
Sat May 18 20:51:37 MDT 2002


Warren wrote:

> Mike Staver <staver at fimble.com> wrote:
>
>  > Does anybody know the file where the hostname is stored at in
>  > Red Hat?
>
> Anytime I am on an unfamiliar *nix, I always used a recursive grep to
> find the pattern I'm looking for.  Such as:
>
>  # grep -r "<pattern>" *
>  # grep -r "<pattern>" *.*
>  # grep -r "<pattern>" .*

This is good advice.  I'd add though that some versions of grep don't
recurse with -r.  In that case:

find /etc -type f | xargs grep <pattern>

The find command will pull out path names for each regular file under
/etc.  xargs breaks the resulting list into chunks that will fit on a
command line and runs grep on each chunk.  The -l and -h switches to grep
might be useful too.

If that fails, you can always read the boot scripts.  Start by looking in
/etc/inittab (perhaps some systems use something else?  try man init) to
see where the boot scripts are.  Then read the ones that look relevant to
see what files they use to configure things (or perhaps what programs they
run and then use the man pages to see what the config files are).  The
trail can be long sometimes, but at least you don't have to remember
*everything*.

Dave





More information about the clue-tech mailing list