Linux中怎么使用hostname命令修改主機名稱,很多新手對此不是很清楚,為了幫助大家解決這個難題,下面小編將為大家詳細講解,有這方面需求的人可以來學習下,希望你能有所收獲。
我們直接運行hostname可以查看目前的主機名稱,要查看hostname的其它命令參數,運行hostname -h如下:
代碼如下:
Usage: hostname [-v] {hostname|-F file} set hostname (from file)
domainname [-v] {nisdomain|-F file} set NIS domainname (from file)
hostname [-v] [-d|-f|-s|-a|-i|-y|-n] display formatted name
hostname [-v] display hostname</p>
<p>hostname -V|–version|-h|–help print info and exit</p>
<p>dnsdomainname=hostname -d, {yp,nis,}domainname=hostname -y</p>
<p>-s, –short short host name
-a, –alias alias names
-i, –ip-address addresses for the hostname
-f, –fqdn, –long long host name (FQDN)
-d, –domain DNS domain name
-y, –yp, –nis NIS/YP domainname
-F, –file read hostname or NIS domainname from given file</p>
<p>This command can read or set the hostname or the NIS domainname. You can
also read 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.
看到-v的用法了嗎?修改主機名命令如下:
代碼如下:
hostname -v 新的主機名
看完上述內容是否對您有幫助呢?如果還想對相關知識有進一步的了解或閱讀更多相關文章,請關注億速云行業資訊頻道,感謝您對億速云的支持。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。