⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 0257-0258.html

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTML
字号:
<HTML>



<HEAD>

<TITLE>Linux Complete Command Reference:User Commands:EarthWeb Inc.-</TITLE>

</HEAD>

<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>

 -->




<!-- ISBN=0672311046 //-->

<!-- TITLE=Linux Complete Command Reference//-->

<!-- AUTHOR=Red Hat//-->

<!-- PUBLISHER=Macmillan Computer Publishing//-->

<!-- IMPRINT=Sams//-->

<!-- CHAPTER=01 //-->

<!-- PAGES=0001-0736 //-->

<!-- UNASSIGNED1 //-->

<!-- UNASSIGNED2 //-->



<P><CENTER>

<a href="0255-0256.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0259-0260.html">Next</A></CENTER></P>







<A NAME="PAGENUM-257"><P>Page 257</P></A>







<H3><A NAME="ch01_ 112">

host

</A></H3>



<P>host&#151;Look up hostnames using domain server

</P>



<P><B>

SYNOPSIS

</B></P>



<!-- CODE SNIP //-->

<PRE>

host [-l] [-v] [-w] [-r] [-d] [-t querytype] [-a] host [ server ]

</PRE>

<!-- END CODE SNIP //-->



<P><B>

DESCRIPTION

</B></P>



<P>host looks for information about Internet hosts. It gets this information from a set of interconnected servers that are

spread across the country. By default, it simply converts between hostnames and Internet addresses. However with the

-t or -a OPTIONS, it can be used to find all of the information about this host that is maintained by the domain server.

</P>



<P>The arguments can be either hostnames or host numbers. The program first attempts to interpret them as host numbers.

If this fails, it will treat them as hostnames. A host number consists of first decimal numbers separated by dots, for

example, 128.6.4.194. A hostname consists of names separated by dots, for example,

topaz.rutgers.edu. Unless the name ends in a dot, the local domain is automatically tacked on the end. Thus, a Rutgers user can say

&quot;host topaz&quot;, and it will actually look up

topaz.rutgers.edu. If this fails, the name is tried unchanged (in this case,

topaz). This same convention is used for mail and other network utilities. The actual suffix to tack on the end is obtained by looking at the results of a hostname call,

and using everything starting at the first dot. (Following is a DESCRIPTION of how to customize the hostname lookup.)

</P>



<P>The first argument is the hostname you want to look up. If this is a number, an

inverse query is done; that is, the domain system looks in a separate set of databases used to convert numbers to names.

</P>



<P>The second argument is optional. It allows you to specify a particular server to query. If you don't specify this argument,

the default server (normally the local machine) is used.

</P>



<P>If a name is specified, you may see output of three different kinds. Here is an example that shows all of them:

</P>



<!-- CODE //-->

<PRE>

% host sun4

sun4.rutgers.edu is a nickname for ATHOS.RUTGERS.EDU

ATHOS.RUTGERS.EDU has address 128.6.5.46

ATHOS.RUTGERS.EDU has address 128.6.4.4

ATHOS.RUTGERS.EDU mail is handled by ARAMIS.RUTGERS.EDU

</PRE>

<!-- END CODE //-->



<P>The user has typed the command host sun4. The first line indicates that the name

sun4.rutgers.edu is actually a nickname. The official hostname is

ATHOS.RUTGERS.EDU. The next two lines show the address. If a system has more than one

network interface, there will be a separate address for each. The last line indicates that

ATHOS.RUTGERS.EDU does not receive its own mail. Mail for it is taken by

ARAMIS.RUTGERS.EDU. There may be more than one such line, as some systems have more than

one other system that will handle mail for them. Technically, every system that can receive mail is supposed to have an entry

of this kind. If the system receives its own mail, there should be an entry the mentions the system itself, for example &quot;XXX

mail is handled by XXX.&quot; However many systems that receive their own mail do not bother to mention that fact. If a system has

a &quot;mail is handled by&quot; entry, but no address, this indicates that it is not really part of the Internet, but a system that is on

the network will forward mail to it. Systems on Usenet, bitnet, and a number of other networks have entries of this kind.

</P>



<P>There are a number of OPTIONS that can be used before the hostname.

Most of these OPTIONS are meaningful only to the

staff who have to maintain the domain database.

</P>



<P>The option -w causes host to wait forever for a response. Normally it will time out after around a minute.

</P>



<P>The option -v causes printout to be in a verbose format. This is the official domain master file format, which is

documented in the man page for named. Without this option, output still follows this format in general terms, but some attempt is

made to make it more intelligible to normal users. Without

-v, a, mx, and cname records are written out as has

address, mail is handled by, and is a nickname for, and TTL and class fields are not shown.

</P>



<P>The option -r causes recursion to be turned off in the request. This means that the name server will return only data it has

in its own database. It will not ask other servers for more information.

</P>



<P>The option -d turns on debugging. Network transactions are shown in detail.

</P>



<A NAME="PAGENUM-258"><P>Page 258</P></A>





<P>The option -t allows you to specify a particular type of information to be looked up. The arguments are defined in the

man page for named. Currently supported types are

a, ns, md, mf, cname, soa, mb, mg, mr, null, wks,

ptr, hinfo, minfo, mx, uinfo, uid, gid, unspec, and the wildcard, which may be written as either

any or *. Types must be given in lowercase. Note that

the default is to look first for a, and then mx, except that if the verbose option is turned on, the default is only a.

</P>



<P>The option -a (for &quot;all&quot;) is equivalent to

-v -t any.

</P>



<P>The option -l causes a listing of a complete domain. For example,

</P>



<!-- CODE SNIP //-->

<PRE>

host -l rutgers.edu

</PRE>

<!-- END CODE SNIP //-->



<P>will give a listing of all hosts in the

rutgers.edu domain. The -t option is used to filter what information is presented, as

you would expect. The default is address information, which also include PTR and NS records. The command host:

</P>



<!-- CODE SNIP //-->

<PRE>

-l -v -t any rutgers.edu

</PRE>

<!-- END CODE SNIP //-->



<P>will give a complete download of the zone data for

rutgers.edu, in the official master file format. (However the SOA

record is listed twice, for arcane reasons.)

</P>

<P>

<P>

<P>



<CENTER>

<TABLE BGCOLOR="#FFFF99">

<TR><TD><B>

NOTE

</B></TD></TR>

<TR><TD>

<BLOCKQUOTE>

 -l is implemented by doing a complete zone transfer and then filtering out the information you have asked for.

This command should be used only if it is absolutely necessary.

</BLOCKQUOTE></TD></TR>

</TABLE></CENTER>

</P>

<P><B>

CUSTOMIZING HOSTNAME LOOKUP

</B></P>



<P>In general, if the name supplied by the user does not have any dots in it, a default domain is appended to the end.

This domain can be defined in /etc/resolv.conf, but is normally derived by taking the local hostname after its first dot. The

user can override this, and specify a different default domain, using the ENVIRONMENT variable

LOCALDOMAIN. In addition, the user can supply his own abbreviations for hostnames. They should be in a file consisting of one line per abbreviation. Each

line contains an abbreviation, a space, and then the full hostname. This file must be pointed to by an ENVIRONMENT

variable HOSTALIASES, which is the name of the file.

</P>



<P><B>

SEE ALSO

</B></P>



<P>named(8)

</P>



<P><B>

BUGS

</B></P>



<P>Unexpected effects can happen when you type a name that is not part of the local domain. Please always keep in mind

that the local domain name is tacked onto the end of every name, unless it ends in a dot. Only if this fails is the name

used unchanged.

</P>



<P>The -l option only tries the first name server listed for the domain that you have requested. If this server is dead, you

may need to specify a server manually. For example, to get a listing of

foo.edu, you could try host -t ns foo.edu to get a list of

all the name servers for foo.edu, and then try host -l foo.edu

xxx for all xxx on the list of name servers, until you find one

that works.

</P>



<H3><A NAME="ch01_ 113">

hostid

</A></H3>



<P>hostid&#151;Set or print system's host ID.

</P>



<P><B>

SYNTAX

</B></P>



<!-- CODE SNIP //-->

<PRE>

hostid [_v] [ decimal-id ]

</PRE>

<!-- END CODE SNIP //-->







<P><CENTER>

<a href="0255-0256.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0259-0260.html">Next</A></CENTER></P>







</td>
</tr>
</table>

<!-- begin footer information -->







</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -