Skip to main content
All CollectionsTroubleshooting and How-ToHow-To Articles
How to find a computer's hostname and username
How to find a computer's hostname and username
A
Written by Arick Disilva
Updated over 4 months ago

If you need to find your computer's host name or the username, for example, during troubleshooting or when instructed to do so by a Teramind Support Agent, here are some commands you can use.

Windows

From your Windows Start Menu or from the Windows Search Bar, type cmd.exe and press Enter.

When the Command Prompt opens, type the following command(s) and press Enter:

whoami

- this will return the computer name and the username. For example, desktop-30lv124\john-work.

whoami /upn

- this will return the User Principal Name (UPN). A UPN in Windows Active Directory is an attribute that consists of a prefix (user account name) and a suffix (DNS domain name) joined by the @ symbol. For example: [email protected]. Note that while the UPN looks like an email address and will often match the employee's email address, it is not one and isn't required to match the employee's email address

echo %username%

- will show the display name in case the account is named differently than the user profile account. For example, John Work.

macOS

Click the Launchpad icon in the Dock, type Terminal in the search field, then click Terminal.

Or, in the Finder , open the /Applications/Utilities folder, then double-click Terminal.

Type the following command(s) from the Terminal prompt and press Enter:

whoami

- similar to Windows' equivalent command (see above).

hostname

- this will return the computer's host name such as john-macbook-pro.

scutil --get HostName

- returns results similar to the hostname command above.

scutil --get LocalHostName

- this will return the computer host name such as john-macbook-pro.local. A local host name designates a computer on a local subnet. This is mostly used for Bonjour-aware services on the local network.

scutil --get ComputerName

- will return the computer's name. For example, John's MacBook Pro.

Did this answer your question?