Changed hostname to -a

I was trying to execute the following command

ifConfig -a

and after a while my hostname changed to -a

I checked /etc/hosts and /etc/nodename all seems to be correct.

  1. How my hostname changed to -a ? (What i could have done wrong)
  2. if you type hostname where does solaris read the name from ?

---------- Post updated at 09:19 PM ---------- Previous update was at 09:18 PM ----------

I could not able to figure out how i changed my hostname ? and how can i roll it back ?

hostname uses a system call (sysinfo or uname) which returns the system name that is stored on kernel memory.

You can simply revert back to the expected name with (ksh/bash syntax):

hostname $(</etc/nodename)
1 Like