Taking Grep to a Lower Level

der.hans plug-discuss@lists.plug.phoenix.az.us
Tue, 5 Nov 2002 22:15:58 -0700 (MST)


Am 05. Nov, 2002 schwätzte George Gambill so:

> Need to change the "computer name" without reloading RH 7.2.
>
> Looking at the man pages for Grep, it (grep) seems to only look in the
> current directory.
>
> How can I grep 'ComputerName' through all subdirectories?

To answer your question:

grep -ri <hostname> /etc 2>/dev/null

rgrep == grep -r

GNU grep ( comes on GNU/Linux systems. go figure :), handles binaries just
fine.

Put the "2>/dev/null" on the end to avoid seeing error messages you don't
care about.

As an aside, use strings to get text data from binaries if there's an issue.

To answer your problem:

Generally you'll find 4 places of importance when changing the hostname:

/etc/hosts
/etc/hostname
SMTP config file
/etc/ssh/*

It might also show up in config files for other services, e.g. apache.

Use 'hostname' to change the name on the live system, change the config
files and restart daemons that track the hostname on their own, e.g. ssh.

ciao,

der.hans
-- 
#  https://www.LuftHans.com/    http://www.TOLISGroup.com/
#  The Internet is the front line of the battle
#  to protect our freedom. -- Nathaniel Borenstein