All Collections
Troubleshooting and How-To
How-To Articles
How to find a computer's hostname and username
How to find a computer's hostname and username
Written by Arick Disilva
Updated over a week 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.


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:


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

whomai /upn

- this will return the User Principal Name (UPN). An UPN in Windows Active Directory is the name of a system user that consists of the user name (logon name) and the domain name (UPN suffix). For example: [email protected]. Note that while the UPN looks like an email address it is not one.

echo %username%

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


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:


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


- 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?