redhat6为例
显示主机名#hostname 显示主机名#hostname linux01 主机名临时设定为linux01
设置主机名,更改下面的文件[root@master mnt]# vim /etc/sysconfig/networkHOSTNAME=linux01 主机名设定为linux01, 永久有效
就是运行hostname命令就是了,如果你没有设置过主机名,一般会显示
localhostlocaldomain
其中localhost表示主机名,localdomain为域名,这是一个完全域名(FQDN,即"主机名域名")的形式 更多相关linux的学习资料,请参考《Linux就该这么学》。Usage: host [-aCdlriTwv] [-c class] [-N ndots] [-t type] [-W time] [-R number] hostname [server] -a is equivalent to -v -t -c specifies query class for non-IN data -C compares SOA records on authoritative nameservers -d is equivalent to -v -l lists all hosts in a domain, using AXFR -i IP6INT reverse lookups -N changes the number of dots allowed before root lookup is done -r disables recursive processing -R specifies number of retries for UDP packets -t specifies the query type -T enables TCP/IP mode -v enables verbose output -w specifies to wait forever for a reply -W specifies how long to wait for a reply -4 use IPv4 query transport only -6 use IPv6 query transport only -s a SERVFAIL response should stop querylinux使用hostname命令可查看服务器名称。
语法:
hostname [-v] [-a, --alias] [-d, --domain] [-f, --fqdn, --long] [-i, --ip-address] [-s, --short] [-y, --yp, --nis] [-F, --filename] [-h, --help] [-V, --version]
命令选项说明:
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)