Linux How To Find Hostname
We are going to show you how to find the hostname of a given Linux system. This is just about the easiest task that you could imagine. For more detailed information including how to change the hostname you should check out our other guide here Linux How to Change Hostname.
To find the hostname of a system you can use the following command.
hostname
That’s it. That should show you the hostname of the system that you are currently logged into. This should work on most if not all distributions of Linux.
As an alternative, you could also use these two commands.
This is a systemd command and will give you the hostname along with a bit more useful, related info.
hostnamectl
You can check your hostname by looking in the proc filesystem.
cat /proc/sys/kernel/hostname