Thread: /bin/hostname
View Single Post

  #2  
Old 08-22-2008, 04:16 PM
Default Re: /bin/hostname

On Fri, 22 Aug 2008 12:55:59 -0700 (PDT), Vwaju wrote:
> I am having trouble with my Debian Linux network configuration, and I
> am trying to isolate the problem. The name of my host is "jupiter"
> and the name of my domain is "obliqueuniverse.org".
>
> jupiter:~# echo jupiter.obliqueuniverse.org > /etc/hostname
>
> jupiter:~# cat /etc/hosts | sed –n 1p
> 127.0.0.1 localhost.localdomain localhost jupiter
>
> jupiter:~# cat /etc/hosts | sed –n 4p
> 207.237.37.110 jupiter.obliqueuniverse.org jupiter


grep jupiter /etc/hosts
127.0.0.1 localhost.localdomain localhost jupiter
207.237.37.110 jupiter.obliqueuniverse.org jupiter

Why do you have jupiter on more than one line.
Look at the ip address when you do a
ping -c1 jupiter


> I believe that /bin/hostname without options should output the host
> name "jupiter", but it doesn't.


Quick look in man hostname, indicates gethostname is used.
man gethostname shows CONFORMING TO
POSIX.1-2001
so I am going to guess hostname default is FQDN.


> jupiter:~# /bin/hostname –nis
> (none) # ? ? ?


Guessing your nis server is not running.


> jupiter:~# /bin/hostname
> jupiter.obliqueuniverse.org # EXPECTED "jupiter"


I would expect that on a POSIX compliant system.


> jupiter:~# /bin/hostname –F /etc/hostname
> # EXPECTED "jupiter"


You told hostname to set hostname from /etc/hostname, not display it.


> jupiter:~# /bin/hostname –-alias
> jupiter # NOW HOSTNAME IS PRINTED!


no surprise there because your earlier test showed
/bin/hostname –short
jupiter

Reply With Quote