How to find your computers device name using a macOS Terminal command

In this video we take a look at a macOS terminal command that will allow us to find the Computer Name that our computer is using. As Computer Name is a unique identifier designed to help us find devices on a network. It can be very useful to know what your computer is called when troubleshooting networking issues.

Note: On macOS you can also find or change your computer name from within System Preferences. This is done by selecting System Preferences – Sharing – Computer Name

Quick reference notes:

  • From your macOS desktop, select Spotlight Search.
  • Within Spotlight Search type Terminal and press Enter on your keyboard
  • Now at the command prompt type.
 scuttle --get localHostName
  • When you press Enter on the keyboard you will be presented with the computer name of your computer.
  • As this command is difficult to remember, the following will also work
hostname
  • To gracefully close your current Terminal session type:
exit
  • When you press Enter on your keyboard the Terminal session will end and you can close the Terminal application.

Reference Material:

Wikipedia article – Terminal (macOS)

Add comment

Leave a Reply