There are two ways to check a hostname on your system:
1. Open a content of the file /etc/hostname
with the command cat
.
cat /etc/hostname
You will get an output with a hostname:
localhost
2. Run in a terminal:
hostnamectl
Sample Output:
As you can see, there is more information available.
Changing the hostname on Ubuntu 20.04
There are a couple ways of changing a hostname on your Ubuntu system.
The most easiest option is to run the following command:
sudo hostnamectl set-hostname *your hostname*
Another method is to edit the following files with any text editor:
/etc/hostname /etc/hosts
Finally, you can confirm the changes by running the hostnamectl
command again.
Comments
0 comments
Please sign in to leave a comment.