3 Ways to Find PC Host Name Using Linux Terminal

Just as an Internet Protocol address or IP address identifies your device, likewise, the host name is another parameter by which you can recognize your device. This is a string of human-readable characters. Unlike an IP address, the host name of a PC is easy to remember and remember. To do this, you always need to know the host name of your PC. In this article, we will tell you how you can find the host name of your PC using Linux Terminal.

Finding a PC host name in Linux

To find the hostname of your PC on Linux, you can do any of the three methods listed below:

Method # 1: Use the hostname command

Launch the terminal by clicking Ctrl + T either click on the terminal icon displayed on the taskbar, or search for a terminal by typing a terminal in the search box and pressing the enter key. The newly opened terminal window is shown below:

Now enter the hostname command in the terminal and press enter.

$ hostname

Enter hostname command

As soon as you press enter, the name of your PC will appear on your terminal. This is shown in the figure below:

The host name is displayed in the shell of the Linux system

Method # 2: Use the hostnamectl command

Launch the terminal by clicking Ctrl + T either click on the terminal icon displayed on the taskbar, or search for the terminal by entering the terminal in the search box and pressing the enter key. The newly opened terminal window is shown below:

Open Shell Window

Now enter the command:

hostnamectl

in the terminal and press enter.

Enter the command: hostnamectl

As soon as you press enter, the host name of your PC will appear in the terminal window. This is shown below:

Details of the Linux system incl. host name displayed

Method number 3: Use the cat command

Launch the terminal by clicking Ctrl + T either click on the terminal icon displayed on the taskbar, or search for a terminal by typing a terminal in the search box and pressing the enter key. The newly opened terminal window is shown below:

The terminal is ready to use.

Now enter the command:

cat /proc/sys/kernel/hostname

in the terminal and press enter.

Show contents of / proc / sys / kernel / hostname

As soon as you press enter, the host name of your computer will be displayed on the terminal. This is shown below:

Host name shown

Conclusion

The three different methods listed above are really very easy and simple. Now you can find the host name of your PC in seconds and without any problems. I hope these methods help you.

3 Ways to Find PC Host Name Using Linux Terminal

Sidebar