目录
内容来源:
GUN : Coreutils - GNU core utilities
busybox v1.36.1 : 【busybox记录】【shell指令】基于的Busybox的版本和下载方式-CSDN博客
【GUN】【hostname】指令介绍
hostname:打印或设置系统名称
如果不带参数,hostname将打印当前主机系统的名称。通过一个参数,它将当前主机名设置为指定的字符串。您必须具有设置主机名的适当权限。
简介:
hostname [name]
唯一的选项是 --help和 --version。参见第2章[常用选项],第2页。
默认情况下不安装hostname,其他包也提供hostname命令,因此可移植脚本不应该依赖于它的存在或上面记录的确切行为。
退出状态为0表示成功,非0表示失败。
【busybox】【hostname】指令介绍
[root@localhost bin]# ./hostname --help
BusyBox v1.36.1 (2024-04-16 11:16:28 EDT) multi-call binary.
Usage: hostname [-sidf] [HOSTNAME | -F FILE]
Show or set hostname or DNS domain name
-s Short
-i Addresses for the hostname
-d DNS domain name
-f Fully qualified domain name
-F FILE Use FILE's content as hostname
【linux】【hostname】指令介绍
[root@localhost bin]# hostname --help
Usage: hostname [-b] {hostname|-F file} 设置主机名(从文件)
hostname [-a|-A|-d|-f|-i|-I|-s|-y] 显示格式化名称
hostname 显示主机名
{yp,nis,}domainname {nisdomain|-F file} 设置NIS域名(from file)
{yp,nis,}domainname display NIS域名
dnsdomainname 显示DNS域名
hostname -V|--version|-h|--help 打印信息并退出
Program name:
{yp,nis,}domainname=hostname -y
dnsdomainname=hostname -d
Program options:
-a, --alias 别名
-A, --all-fqdns 全长主机名(FQDNs)
-b, --boot 如果没有可用的主机名,设置默认主机名
-d, --domain DNS域名
-f, --fqdn, --long 长主机名(FQDN)
-F, --file 从给定文件中读取主机名或NIS域名
-i, --ip-address 主机名的地址
-I, --all-ip-addresses 主机的所有地址
-s, --short 短主机名
-y, --yp, --nis NIS/YP域名
Description:
This command can get or set the host name or the NIS domain name. You can
also get the DNS domain or the FQDN (fully qualified domain name).
Unless you are using bind or NIS for host lookups you can change the
FQDN (Fully Qualified Domain Name) and the DNS domain name (which is
part of the FQDN) in the /etc/hosts file.
使用示例:
NA
常用组合指令:
NA