Last Updated : 07 Nov, 2019
hostnamectlcommand provides a proper API used to control Linux system hostname and change its related settings. The command also helps to change the hostname without actually locating and editing the
/etc/hostnamefile on a given system.
Syntax:hostnamectl [OPTIONS...] COMMAND ....
Where
COMMANDcan be any of the following:
Running
hostnamectlcommand to check the current host names. We can either execute
hostnamectlor
hostnamectl status, the result will be same as status option is automatically assumed if no option is given.
Example 2:To change static host name to
geeksforgeeks. It may require root permission.
hostnamectl set-hostname geeksforgeeks --static
Now, let us verify the changed hostnames using the
hostnamectlcommand.
As you see that the static hostname has been updated to
geeksforgeeks.
Options:RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4