hostname 中文man页面

系统
Hostname 是一个用来设置或显示当前主机,域或者系统的节点名的程序.许多联网程序使用这些名字来标识机器.NIS/YP同样也使用域名.

NAME(名称)

hostname - 显示或设置系统的主机名
domainname - 显示或设置系统的NIS/YP域名
dnsdomainname - 显示系统的DNS域名
nisdomainname - 显示或设置系统的NIS/YP域名
ypdomainname - 显示或设置系统的NIS/YP域名
nodename - 显示或设置系统的DECnet节点名

SYNOPSIS(总览)

hostname [-v] [-a] [--alias] [-d] [--domain] [-f] [--fqdn] [-i] [--ip-address] [--long] [-s] [--short] [-y] [--yp] [--nis] [-n] [--node]

hostname [-v] [-F filename] [--file filename] [hostname]

domainname [-v] [-F filename] [--file filename] [name]

nodename [-v] [-F filename] [--file filename] [name]

hostname [-v] [-h] [--help] [-V] [--version]

dnsdomainname [-v]
nisdomainname [-v]
ypdomainname [-v]

DESCRIPTION(描述)

Hostname 是一个用来设置或显示当前主机,域或者系统的节点名的程序.许多联网程序使用这些名字来标识机器.NIS/YP同样也使用域名.

GET NAME(获取名字)

如果不调用任何参数,程序即显示当前的名字:

hostname 会打印系统的名字为通过 gethostname(2) 函数返回的值.

domainname,nisdomainname,ypdomainname 会打印系统的名字为通过 getdomainname(2) 函数返回的值.这同时也被看作系统的YP/NIS域名.

nodename 会打印系统的DECnet节点名为通过 getnodename(2) 函数返回的值.

dnsdomainname 会打印FQDN(完全资格域名)的域部分.系统的完整的FQDN可使用 hostname --fqdn 返回.

SET NAME(设置名字)

如果带一个参数或者带 --file 选项调用的话,命令即设置主机名,NIS/YP域名或者节点名.

注意,只有超级用户才可以修改这些名字.

不可能使用 dnsdomainname 命令(参看下面的 THE FQDN ) 来设置FQDN或者DNS域名.

每次系统启动时,主机名通常在 /etc/rc.d/rc.inet1/etc/init.d/boot (一般通过读取文件的内容,其中包括了主机名,例如, /etc/hostname )中设置.

THE FQDN

你不能使用该命令修改FQDN(通过 hostname --fqdn 返回) 或者DNS域名(通过 dnsdomainname 返回).系统的FQDN是一个由 resolver(3) 返回的主机名.

从技术上说:FQDN指的是使用 gethostbyname(2) 以返回 gethostname (2) 所返回主机名的名字. DNS域名是***个圆点之后的部分.

因此它依赖于你修改方式的配置(通常在 /etc/host.conf 中).通常(如果hosts文件在DNS或NIS之前解析)你可以在 /etc/hosts 中修改.

OPTIONS(选项)

-a,--alias
显示主机的别名(如果使用了的话).
-d,--domain
显示DNS域名.不要使用命令 domainname 来获得DNS域名,因为这会显示NIS域名而非DNS域名.可使用 dnsdomainname 替换之.
-F,--file filename
从指定文件中读取主机名.注释(以一个`#'开头的行)可忽略.
-f,--fqdn,--long
显示FQDN(完全资格域名).一个FQDN包括一个短格式主机名和DNS域名.除非你正在使用bind或者NIS来作主机查询,否则你可以在/etc/hosts文件中修改FQDN和DNS域名(这是FQDN的一部分).
-h,--help
打印用法信息并退出.
-i,--ip-address
显示主机的IP地址(组).
-n,--node
显示DECnet节点名.如果指定了参数(或者指定了 --file name ),那么root也可以设置一个新的节点名.
-s,--short
显示短格式主机名.这是一个去掉***个圆点后面部分的主机名.
-V,--version
在标准输出上打印版本信息并以成功的状态退出.
-v,--verbose
详尽说明并告知所正在执行的.
-y,--yp,--nis
显示NIS域名.如果指定了参数(或者指定了 --file name ),那么root也可以设置一个新的NIS域.

FILES(相关文件)

/etc/hosts  

AUTHOR(作者)

Peter Tobias, <tobias@et-inf.fho-emden.de>
ernd Eckenfels, <net-tools@lina.inka.de> (NIS and manpage).
Steve Whitehouse, <SteveW@ACM.org> (DECnet support and manpage).

#p#

NAME

hostname - show or set the system's host name
domainname - show or set the system's NIS/YP domain name
dnsdomainname - show the system's DNS domain name
nisdomainname - show or set system's NIS/YP domain name
ypdomainname - show or set the system's NIS/YP domain name

SYNOPSIS

hostname [-v] [-a] [--alias] [-d] [--domain] [-f] [--fqdn] [-i] [--ip-address] [--long] [-s] [--short] [-y] [--yp] [--nis] [-n] [--node]

hostname [-v] [-F filename] [--file filename] [hostname]

domainname [-v] [-F filename] [--file filename] [name]

nodename [-v] [-F filename] [--file filename] [name]

hostname [-v] [-h] [--help] [-V] [--version]

dnsdomainname [-v]
nisdomainname [-v]
ypdomainname [-v]

DESCRIPTION

Hostname is the program that is used to either set or display the current host, domain or node name of the system. These names are used by many of the networking programs to identify the machine. The domain name is also used by NIS/YP.

GET NAME

When called without any arguments, the program displays the current names:

hostname will print the name of the system as returned by the gethostname(2) function.

domainname, nisdomainname, ypdomainname will print the name of the system as returned by the getdomainname(2) function. This is also known as the YP/NIS domain name of the system.

dnsdomainname will print the domain part of the FQDN (Fully Qualified Domain Name). The complete FQDN of the system is returned with hostname --fqdn.

SET NAME

When called with one argument or with the --file option, the commands set the host name, the NIS/YP domain name or the node name.

Note, that only the super-user can change the names.

It is not possible to set the FQDN or the DNS domain name with the dnsdomainname command (see THE FQDN below).

The host name is usually set once at system startup in /etc/rc.d/rc.inet1 or /etc/init.d/boot (normally by reading the contents of a file which contains the host name, e.g. /etc/hostname).

THE FQDN

You can't change the FQDN (as returned by hostname --fqdn) or the DNS domain name (as returned by dnsdomainname) with this command. The FQDN of the system is the name that the resolver(3) returns for the host name.

Technically: The FQDN is the name gethostbyname(2) returns for the host name returned by gethostname(2). The DNS domain name is the part after the first dot.

Therefore it depends on the configuration (usually in /etc/host.conf) how you can change it. Usually (if the hosts file is parsed before DNS or NIS) you can change it in /etc/hosts.

OPTIONS

-a, --alias
Display the alias name of the host (if used).
-d, --domain
Display the name of the DNS domain. Don't use the command domainname to get the DNS domain name because it will show the NIS domain name and not the DNS domain name. Use dnsdomainname instead.
-F, --file filename
Read the host name from the specified file. Comments (lines starting with a `#') are ignored.
-f, --fqdn, --long
Display the FQDN (Fully Qualified Domain Name). A FQDN consists of a short host name and the DNS domain name. Unless you are using bind or NIS for host lookups you can change the FQDN and the DNS domain name (which is part of the FQDN) in the /etc/hosts file.
-h, --help
Print a usage message and exit.
-i, --ip-address
Display the IP address(es) of the host.
-s, --short
Display the short host name. This is the host name cut at the first dot.
-V, --version
Print version information on standard output and exit successfully.
-v, --verbose
Be verbose and tell what's going on.
-y, --yp, --nis
Display the NIS domain name. If a parameter is given (or --file name ) then root can also set a new NIS domain.

FILES

/etc/hosts  

AUTHOR

Peter Tobias, <tobias@et-inf.fho-emden.de>
Bernd Eckenfels, <net-tools@lina.inka.de> (NIS and manpage).
Steve Whitehouse, <SteveW@ACM.org> (DECnet support and manpage).

责任编辑:韩亚珊 来源: CMPP.net
相关推荐

2011-08-24 16:48:36

man中文man

2011-08-15 10:21:09

man中文man

2011-08-11 16:11:49

at中文man

2011-08-25 10:21:56

man.conf中文man

2011-08-25 15:39:42

fcloseall中文man

2011-08-25 15:00:15

cfgetispeed中文man

2011-08-19 18:35:50

issue中文man

2011-08-25 17:03:51

pclose中文man

2011-08-25 17:40:25

setvbuf中文man

2011-08-23 14:21:16

poweroff中文man

2011-08-24 15:52:59

intro中文man

2011-08-23 13:40:31

2011-08-25 15:54:08

ferror中文man

2011-08-25 14:40:27

basename中文man

2011-08-25 17:24:54

puts中文man

2011-08-25 18:34:55

ungetc中文man

2011-08-23 10:03:40

useradd中文man

2011-08-23 16:24:57

smbmnt中文man

2011-08-23 10:29:02

chpasswd中文man

2011-08-23 10:34:22

convertquot中文man
点赞
收藏

51CTO技术栈公众号