Which command shows or sets the system's host name?

Subh Singh
Invent the Future

In Linux, the hostname command is used to show or change the computer's name.

Command:

hostname

Example:

If you want to see your computer's name in Linux, you can use the following command.

hostname

Output:

localhost.localdomain

Here:

  • The output shows the computer's name.

How to use:

  • Open the Linux terminal.
  • Type the command.
  • Press Enter to see the computer's name.

To change the computer's name:

sudo hostname newname