0

From terminal on my mac, I forked a repo from github, and while that process was taking place I opened a new tab. While the new tab was opening up, I hit a key combination that I am uncertain of. My default terminal line now has some content on it that I do not recognize.

Before:

"owner name"-macbook:~ "username"$

After:

a-12-345-67-89:~ "username"$

I've changed the letter and the numbers in case those represent sensitive information that would allow unauthorized access to my computer, but the format is the same.

What has happened here and how can I change it back?

2 Answers2

0

By default, the name before the : is the hostname of the device at the time that the shell command is spawned. Based on your example above, you connected to a network where the IP address that you are using (were using at the time that you spawned the new shell in Terminal) had a domain name that revered to a-12-345-67-89.foo.something.com (or something similar).

This is a problem that's pretty common when you are on a non-NAT network (some public internet access, some coffee houses, certain corporate or educational networks), where the names are not dynamic.

When your computer is on a NAT network, such as in a home, there usually isn't a reverse name for your IP address, in which case the hostname command will return the name of your machine as described in the Network settings panel.

The easy way to change this back (once you've left that network) is to close the shell and re-open the tab or window. Leaving the network can mean turning off your WIFI temporarily or going to a network that doesn't have reverse name configurations.

For a permanent "fix" you can change your prompt string for your shell (see the man page for your specific shell, as they each have different requirements and capabilities).

gaige
  • 17,263
  • 6
  • 57
  • 68
0

Turns out when I have my macbook hardwired to the internet (instead of using wifi), the shell prompt changes. I don't know why that is, but that I what I have noticed.