I have accidentally changed my system to host name. Now i want to change it to my previous host name. But i don't know the previous host name.
2 Answers
Have a look at these files:
/etc/hostname
/etc/hosts
/etc/ssh/ssh_host_*_key.pub
$HOME/.ssh/id_*.pub
In these typically the host name appears and it might be still unchanged by your renaming action (however you did that).
Also these might contain the old name:
/var/log/Xorg.failsafe.log
/var/log/auth.log.1
/var/log/pm-suspend.log.1
/var/log/Xorg.1.log.old
/var/log/lightdm/x-0.log
/var/log/lightdm/x-1.log
/var/log/lightdm/x-2.log
/var/log/pm-suspend.log
/var/log/Xorg.0.log.old
/var/log/Xorg.1.log
/var/log/syslog
/var/log/Xorg.2.log
/var/log/auth.log
/var/log/kern.log.1
/var/log/kern.log
/var/log/Xorg.failsafe.log.old
/var/log/syslog.1
/var/log/Xorg.0.log
In most cases HOSTNAME is defined in /etc/sysconfig/network file, to be set when boot. In some cases you can find it in /etc/hostname
-
in /etc/sysconfig/network file i am seeing my latest file name not my previous which i can also see using hostname command.– TajinderCommented Jan 8, 2014 at 13:58
-
So you probably changed the hostname by modifying the network file, instead of "$ hostname newname". In that case the only solution is querying the logfiles as mentioned before.– Marco B.Commented Jan 10, 2014 at 14:34