# problem with hostname

**URL:** <https://forums.suse.com/t/problem-with-hostname/22218>\
**Category:** SLED Configure-Administer\
**Created:** [February 15, 2012, 10:44pm UTC](https://forums.suse.com/t/problem-with-hostname/22218 "2012-02-15T22:44:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![albumns](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@albumns](https://forums.suse.com/u/albumns)\
**Post date:** [February 15, 2012, 10:44pm UTC](https://forums.suse.com/t/problem-with-hostname/22218/1 "2012-02-15T22:44:26Z")

</div>

Hello:  
I’ve set my hostname as: ABC and domainname: EDF by YAST  
I found that when I use command ‘hostname’ in terminal, it said:

ABC

But I expect it should be ABC.EDF which also display the domain name…

Does anybody how to do this?

THX

---

<div class="post-metadata">

**Author:** ![mikewillis](https://avatars.discourse-cdn.com/v4/letter/m/b2d939/32.png) [@mikewillis](https://forums.suse.com/u/mikewillis)\
**Post date:** [February 15, 2012, 11:28pm UTC](https://forums.suse.com/t/problem-with-hostname/22218/2 "2012-02-15T23:28:11Z")

</div>

> [@albumns;2414](#):
>
> But I expect it should be ABC.EDF which also display the domain name…

I would expect it to say ABC not ABC.EDF. If you want the hostname command to show the domain as well use

```auto
$ hostname -f
```

For more info see

`$ hostname --help
$ man hostname`

---

<div class="post-metadata">

**Author:** ![malcolmlewis](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/malcolmlewis/32/11375_2.png) [@malcolmlewis](https://forums.suse.com/u/malcolmlewis)\
**Post date:** [February 15, 2012, 11:26pm UTC](https://forums.suse.com/t/problem-with-hostname/22218/3 "2012-02-15T23:26:48Z")

</div>

> [@albumns](#):
>
> Hello:  
> I’ve set my hostname as: ABC and domainname: EDF by YAST  
> I found that when I use command ‘hostname’ in terminal, it said:
> 
> ABC
> 
> But I expect it should be ABC.EDF which also display the domain  
> name…
> 
> Does anybody how to do this?
> 
> THX

Hi  
Use hostname -f (hostname --help 😉 )

–  
Cheers Malcolm Â°Â¿Â° (Linux Counter #276890)  
SUSE Linux Enterprise Desktop 11 (x86\_64) Kernel 3.0.13-0.19-default  
up 1 day 22:37, 3 users, load average: 0.00, 0.01, 0.05  
CPU Intel i5 CPU M520@2.40GHz | Intel Arrandale GPU

---

<div class="post-metadata">

**Author:** ![albumns](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@albumns](https://forums.suse.com/u/albumns)\
**Post date:** [February 16, 2012, 7:42am UTC](https://forums.suse.com/t/problem-with-hostname/22218/4 "2012-02-16T07:42:03Z")

</div>

Thank you very much for your kind reply.  
but my academic software was licensed to a machine named “ABC.DEF” which showned in SLES 10. When I update the system into 11, my academic software claimed my machine name is “ABC” not “ABC.DEF” and the license server cannot be started…

THX

[QUOTE=malcolmlewis;2416]Hi  
Use hostname -f (hostname --help 😉 )

–  
Cheers Malcolm Â°Â¿Â° (Linux Counter #276890)  
SUSE Linux Enterprise Desktop 11 (x86\_64) Kernel 3.0.13-0.19-default  
up 1 day 22:37, 3 users, load average: 0.00, 0.01, 0.05  
CPU Intel i5 CPU M520@2.40GHz | Intel Arrandale GPU[/QUOTE]

---

<div class="post-metadata">

**Author:** ![albumns](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@albumns](https://forums.suse.com/u/albumns)\
**Post date:** [February 16, 2012, 7:52am UTC](https://forums.suse.com/t/problem-with-hostname/22218/5 "2012-02-16T07:52:58Z")

</div>

[QUOTE=mikewillis;2415]I would expect it to say ABC not ABC.EDF. If you want the hostname command to show the domain as well use

```auto
$ hostname -f
```

For more info see

`$ hostname --help
$ man hostname`[/QUOTE]

in fact, it doesn’t work with command: hostname -f

it said in terminal:

hostname: Unknown host

---

<div class="post-metadata">

**Author:** ![malcolmlewis](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/malcolmlewis/32/11375_2.png) [@malcolmlewis](https://forums.suse.com/u/malcolmlewis)\
**Post date:** [February 16, 2012, 8:10am UTC](https://forums.suse.com/t/problem-with-hostname/22218/6 "2012-02-16T08:10:11Z")

</div>

> [@albumns](#):
>
> Thank you very much for your kind reply.  
> but my academic software was licensed to a machine named “ABC.DEF”  
> which showned in SLES 10. When I update the system into 11, my academic  
> software claimed my machine name is “ABC” not “ABC.DEF” and the license  
> server cannot be started…
> 
> THX
> 
> malcolmlewis;2416 Wrote:[color=blue]
> 
> > Hi  
> > Use hostname -f (hostname --help 😉 )  
> > [/color]

Hi  
So what about the other hostname options any output? Can you check it’s  
set;

```auto
fgrep -r "ABC" /etc/*
```

Where ABC is your hostname, also swap for your domain name.

–  
Cheers Malcolm Â°Â¿Â° (Linux Counter #276890)  
SUSE Linux Enterprise Desktop 11 (x86\_64) Kernel 3.0.13-0.19-default  
up 2:10, 3 users, load average: 0.06, 0.05, 0.05  
CPU Intel i5 CPU M520@2.40GHz | Intel Arrandale GPU

---

<div class="post-metadata">

**Author:** ![smflood](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/smflood/32/10576_2.png) [@smflood](https://forums.suse.com/u/smflood)\
**Post date:** [February 20, 2012, 3:05pm UTC](https://forums.suse.com/t/problem-with-hostname/22218/7 "2012-02-20T15:05:49Z")

</div>

On 16/02/2012 05:54, albumns wrote:  
[color=blue]

> in fact, it doesn’t work with command: hostname -f
> 
> it said in terminal:
> 
> hostname: Unknown host[/color]

I can confirm on SLES11 SP1 that hostname -f a) works, and b) works  
correctly _provided_ /etc/hosts has the correct entry in the form

IP-Address Full-Qualified-Hostname Short-Hostname

With a default install (plus OES11) the entry for my host was

IP-Address Short-Hostname Short-Hostname

so whilst hostname correctly returned Short-Hostname, hostname -f also  
returned Short-Hostname whilst hostname -d returned nothing. Editing the  
/etc/hosts entry to append domain to first Short-HostName value “fixed”  
the output of both hostname -f and hostname -d.

## HTH.

Simon  
Novell/SUSE/NetIQ Knowledge Partner

* * *

## Do you work with Novell technologies at a university, college or school? If so, your campus could benefit from joining the Novell Technology Transfer Partner (TTP) program. See [novell.com/ttp](http://novell.com/ttp) for more details.
