How to change a machine name?

kitepilot at kitepilot.com kitepilot at kitepilot.com
Fri Jan 4 17:25:12 MST 2013


Joe, 'changing a name' can be a *CAN* of worms.
Do:
find /etc/ -type f -exec grep -l "$(hostname)" "{}" \;
and that will tell you all the files where the current hostname is 
hardcoded.
Yes, it *DOES* get hardcoded in multiple places. 

Now you can:
for FILE in $(find /etc/ -type f -exec grep -l "$(hostname)" "{}" \;);do
      sed -i.B4_HOSTNAME_CHANGE -e "s/$(hostname)/mynewname/g" "${FILE}"
done 

And finally:
hostname mynewname
That should do the trick, YMMV.
Free advice, can't sue me!   :) 

As for the IP, why do you want to change the IP?
There are multiple ways to accomplish that (persistently) and most depend on 
the distro flavor.
You could even use your router for that purpose, but why?
ET 

 

joe at actionline.com writes: 

> What is the procedure to change the machine/system name? 
> 
> For example, one of my computer's names that appears at the prompt is:
> joe at joe-T60:~$
> I'd like to simplify it to just t60: 
> 
> Likewise, I'd like to change my other computers machine names to simpler
> names. 
> 
> Also, is it possible to change the ip addresses of one's computers and
> other devices; and if so, how can that be done? 
> 
>  
> 
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.phxlinux.org
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss


More information about the PLUG-discuss mailing list