hostname and hostname -s

hostname and hostname -s

Post by Neil Zanell » Mon, 22 Jan 2001 03:59:44



Hello,

I have net-tools 1.54 installed and I am experiencing the following
problem which I presume might be a bug in hostname...

When I boot my RHL 6.2 machine with my ethernet card disconnected I can
run the hostname command which successfully outputs my hostname but when
I run hostname -s the command does not produce the short name as described
in the manual and instead complains about a failed DNS lookup. But if
hostname works then all hostname -s should do is the equivalent of:

hostname | awk 'BEGIN { FS="." }; { print $1 }'

Why can't hostname -s just do that? According to the man page:

       -s, --short
              Display  the short host name. This is the host name
              cut at the first dot.

Thanks!

Neil

 
 
 

hostname and hostname -s

Post by Karl Heye » Mon, 22 Jan 2001 07:36:47


In article


> Hello,

> I have net-tools 1.54 installed and I am experiencing the following
> problem which I presume might be a bug in hostname...

> When I boot my RHL 6.2 machine with my ethernet card disconnected I
> can run the hostname command which successfully outputs my hostname
> but when I run hostname -s the command does not produce the short
> name as described in the manual and instead complains about a failed
> DNS lookup. But if hostname works then all hostname -s should do is
> the equivalent of:

> hostname | awk 'BEGIN { FS="." }; { print $1 }'

> Why can't hostname -s just do that? According to the man page:

>        -s, --short
>               Display  the short host name. This is the host name
>               cut at the first dot.

> Thanks!

Do you have a proper formatted line in hosts for you machine.

<IP> my.host.net  alias

karl.

 
 
 

1. Use hostname or hostname.domain.name in /etc/hosts??

Should the /etc/hosts file list hostnames in fully-qualified domain name format
or just the bare hostname?  Linux setups seem to push the fqdn option as the
standard.  Having a mixture interfers with all sorts of things, and I'd
like to standardise.  I can see some security advantage in using the domain
names in exports files, etc, when nis or dns is used, but why /etc/hosts?

Who decides on such conventions?

Mark Aitchison.

2. Help configuring KSamba

3. hostname.hme0 or hostname.hme1

4. upgrading to 2.4 kernel and egcs

5. Boot error message: My unqualified hostname (hostname) unknown; sleeping for retry...

6. more than 2GB swap on solaris...

7. HELP: hostname.leo; hostname files

8. initrd line in lilo.conf: what does it do?

9. What if I write ipaddress, not hostname in hostname.eri1?

10. hostname: can't find a FQDN for the hostname 'froz'

11. hostname.le0 and hostname.hme0

12. hostname (net-2) cannot find hostname.

13. Rewrite hostname to hostname.domain.tld