hostnamectl command in Linux with Examples Last Updated : 07 Nov, 2019 Comments Improve Suggest changes Like Article Like Report hostnamectl command 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/hostname file on a given system. Syntax: hostnamectl [OPTIONS...] COMMAND .... Where COMMAND can be any of the following: status: Used to check current hostname settings. set-hostname NAME: Used to set system hostname. set-icon-name NAME: Used to set icon name for host. set-chassis NAME: Set chassis type for host. Types of hostname: Static: Assigned by system admin and it is used to initialize the kernel hostname during boot time. Dynamic or Transient: Assigned by mDNS server or DHCP server during run time. Pretty: It's a high-level hostname assigned by system admin or end-user. Example 1: Running hostnamectl command to check the current host names. We can either execute hostnamectl or 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 hostnamectl command. As you see that the static hostname has been updated to geeksforgeeks. Options: -h, --help: Show help text and exit. --version: Show package version and exit. --transient: This option is used when we particularly want to set transient hostname only. Example: To set transient name to ubuntu. Now, let's check the transient name using hostnamectl. --static: This option is used when we only want to set static hostname. Now, let's verify the change using hostnamectl. --pretty: This option is used when we only want set pretty hostname. The name that is to be set needs to be in the double quote(" "). Verifying the change using following command: hostnamectl --pretty status --no-ask-password: This option do not prompt for password for authentication in any privileged operations. -H --host=[USER@]HOST: This option is used to change the host names remotely. May need root privilege while execution. hostnamectl set-hostname -H [username]@HostName Here, HostName is the remote host that we want to configure. Example: To set server3 as host name on a remote server called as 172.102.2.24 we can use the following command: hostnamectl set-hostname server3 -H [email protected] Comment More infoAdvertise with us suraj1994 Follow Improve Article Tags : Linux-Unix linux-command Linux-networking-commands Similar Reads gunzip Command in Linux with Examples The gunzip command in Linux is a popular tool for decompressing files compressed with gzip. It simplifies file unzipping, enhances file management, and optimizes disk space in Linux environments.In this blog post, we will explore how gunzip works, providing practical examples for you to try. Whether 5 min read halt command in Linux with examples This command in Linux is used to instruct the hardware to stop all the CPU functions. Basically, it reboots or stops the system. If the system is in runlevel 0 or 6 or using the command with --force option, it results in rebooting of the system otherwise it results in shutdown. Syntax: halt [OPTION] 2 min read hash command in Linux with examples The `hash` is a command in Linux that helps in managing the hash table. It facilitates with mapping the names of executable files to their locations on disk. It helps in speeds uping the commands execution by remembering paths of frequently used commands. It uses the `hash` to view hashed commands ( 5 min read hdparm command in Linux with Examples "hdparm" (i.e., hard disk parameter) is one of the command line programs for Linux that is used to handle disk devices and hard disks. With the help of this command, you can get statistics about the hard disk, alter writing intervals, acoustic management, and DMA settings. It can also set parameters 4 min read Head Command in Linux With Examples Need to quickly view the beginning of a file in Linux? The head command is your best option. This essential command-line tool enables users, developers, and system administrators to preview the start of log files, configuration files, CSV datasets, and other text documents in seconds.The head comman 6 min read help Command in Linux with examples If youâre new to the Linux operating system and struggling with command-line utilities, the help command is one of the first tools you should learn. As its name suggests, the 'help' command provides detailed information about built-in shell commands, making it an essential resource for beginners and 5 min read hexdump command in Linux with examples The 'hexdump' command in Linux is a versatile utility used to display file content or data from standard input in a human-readable format. It is invaluable for programmers and system administrators for debugging binary data, analyzing file structures, and verifying data integrity. Here we will get a 5 min read How to Display Command History in Linux | history Command The history command in Linux is essential for terminal users, enabling them to view, search, and manipulate previously executed commands. Now, mastering this Linux command allows for efficient commands of commands, automation of repetitive tasks, and troubleshooting without the need to retype length 3 min read host command in Linux with examples host command in Linux system is used for DNS (Domain Name System) lookup operations. In simple words, this command is used to find the IP address of a particular domain name or if you want to find out the domain name of a particular IP address the host command becomes handy. You can also find more s 2 min read hostid command in Linux with examples hostid is a command in Linux that is used to display the Host's ID in hexadecimal format. It provides a quick and straightforward way to retrieve the host ID, allowing administrators to associate it with software licenses or perform system-specific operations. Syntax of `hostid` command in Linuxhost 1 min read Like