Re: Find every instance of hostname

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2006-08-26 at 07:48 +0100, Anne Wilson wrote:
> I have a small problem on my laptop which springs from the sender of an email 
> being set as logwatch.localhost.localdomain.  I have so far been unable to 
> find which config file needs editing to get the correct hostname, so I'd like 
> to be able to search this box, where everything is fine, for config files 
> that contain the box's hostname.  I could then check the list against the ones 
> on the laptop.
> 
> It should be simple enough to do using find and grep, but I can't get a 
> command that gives me the output I need.  How can I do it?
----
1 - hostname...

$ cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=lin-workstation.azapple.com
GATEWAY=192.168.2.254

$ cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               localhost.localdomain localhost
192.168.2.10            lin-workstation.azapple.com lin-workstation

2 - grep

# grep -r localhost.localdomain /*

if root...

if user, then to filter out the 'Permission denied'

$ grep -r localhost.localdomain /etc/* > /tmp/test.txt

will display standard error on screen but the stuff you want will go
into the file you created

I'm sure that others more skilled in bash can give you other
alternatives but this will work.

Craig


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux