Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use hostname command to modify host name in Linux

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Linux how to use the hostname command to modify the host name, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

We can view the current host name by running hostname directly. To view other command parameters of hostname, run hostname-h as follows:

The code is as follows:

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

Hostname-V |-version |-h |-help print info and exit

Dnsdomainname=hostname-d, {yp,nis,} domainname=hostname-y

-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.

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.

Do you see the usage of-v? The command to modify the hostname is as follows:

The code is as follows:

Hostname-v new hostname

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report