How To Find Computer Name In Windows, Linux, MacOSX?

A computer name is used to describe a computer unique. Even it is not guaranteed to be unique it is very useful to describe different systems which may be Windows, Linux, and MacOSX. Computer names can be displayed in different ways in different operating systems. A computer name also called a hostname which can be used in DNS-related identification.

Find Computer Name In Windows

Windows computer name can be displayed in different ways like GUI , MS-DOS, PowerShell etc. Windows computer name is also used in Windows Domains in order to describe the Windows system unique and manage properly.

Find Computer Name via About PC

The computer name of a Windows system is povided via the About PC screen for Windows 8 and Windows 10. Type “about” in the Start Menu and open the “About your PC” item like below.

Open About PC Screen

The computer name is displayed in the Device name row like below.

Computer Name in Windows 8 and Windows 10

Find Computer Name via PowerShell

The PowerShell command line interface provides environment variable $env:computername which displays the computer name.

$env:computername

Also the hostname command can be used to print the computer name which is actually a MS-DOS command.

hostname

Find Computer Name via MS-DOS

The MS-DOS provides the hostname command by default which prints the computer name.

hostname

Find Computer Name In Linux

Linux provides different ways and command in order to display the computer name.

Find Computer Name with hostname Command In Bash

Bash is the standard command line interface for the most of the Linux distributions. The hostname command can be used to display computer name.

hostname

Find Computer Name with hostnamectl Command In Bash

The hostnamectl command is the next generation of the hostname command. The hostnamectl provides the computer name as well as more information like machine ID, operating system etc.

hostnamectl

Find Computer Name with /etc/hostname File

The computer hostname information is stored in the “/etc/hostname” file in most of the Linux distributions. The computer name information can be printed into the terminal with the cat command like below.

$ cat /etc/hostname

Find Computer Name In MacOSX

MacOSX also uses similar interface to the Linux. The computer name is generally named as hostname and can be displayed via GUI or with different commands.

Find Computer Name via System Preferences

The GUI way of finding computer name of the MacOSX is likebelow.

  • Click on the Apple logo on the top left corner.
  • Click the System Preferences
  • Click on the Sharing
  • The computer name is displayed in the Computer Name field.

Find Computer Name via Terminal

Similar to the Linux command line interface the hostname command can be used to print the computer name of the MacOSX system via terminal. Type the following command into the terminal.

hostname

Leave a Comment