[NTLUG:Discuss] Re: Renaming a Linux host

Thomas Cameron thomas.cameron at camerontech.com
Sun Jul 24 19:01:45 CDT 2005


On Sun, 2005-07-24 at 23:15 -0500, Leroy Tennison wrote:

> I was afraid someone was going to say something to that effect, it never 
> seems to be that easy.  BTW, I'm running into problems with 'grep -R 
> <hostname> *' on Red hat 9.  It never seemed to complete (waited an hour 
> on a 1.7GHz host with a 40GB HD which is 73% full).  I then decided to 
> get a little omre sophisticated and do (at /)
> 
> for i in `ll | grep ^d | awk '$0 ~ "dev" {next}; $0 ~ "proc" {next}; 
> {print $NF}'`; do grep -R <hostname> $i; done
> 
> but grep still ran out of resources in /var.  Any ideas or, by the time 
> I get to /var, do I care?

To change the hostname, edit /etc/hosts and /etc/sysconfig/network.

To grep for a string in all the files under a directory, I usually use

find /path -type f | xargs grep "foo"

where "path" is the directory I want to search, and "foo" is the string
I am looking for.  It typically works for me.

-- 
Thomas Cameron, RHCE, CNE, MCSE, MCT
512-241-0774 (office)
512-924-8592 (cell)





More information about the Discuss mailing list