Unexpected changes to command line When I open up a command line on my Mac the welcome message is usually

Last login date
Johns-MacBook-Pro$


This now reads...

Last login: Fri Dec 18 23:48:34 on ttys000
Johns-MBP-2:~ johnw$


What does the -2 mean and why did this change? In between noticing these changes I moved between two different wireless networks; one being a regular Fi-Fi network, and the other being a portable hotspot off of a cell phone. I also downloaded a zip file. Could this be a virus? This doesn't appear so as running users only returns my name and running ac -p returns

root         0.05
johnw     7452.99
total     7453.04 


Can someone please explain me to me why this changed? I do see setting hostname change in the console.

network changed: v4(en1!:my ip address from phone) DNS+ Proxy+ SMB
configd[24]: setting hostname to  "Johns-MBP-2" 


Is this from changing internet connections or could this be from malicious software? Or is this because I changed Wi-Fi credentials and opened new terminal windows when I had previous ones open from when I was using the other Wi-Fi networks?
This is a bug in the implementation of iOS/OS X in my eyes. What used to be a good thing is now a pain in the behind.


Computer name keeps changing OSX 10.10 (14A389)
Why does an iPhone rename itself with (2)
My Mac mini&#39;s computer name keeps changing when it resumes from sleep


This has been something that people of Apple products have been dealing with since 2012 on a widespread basis. It's easier to fix on OS X where you can call the scutil command:

scutil --get ComputerName
scutil --set ComputerName "Whatever You Wish"


The only positive thing is that in some cases, people depend on host names so making the change visible in the terminal has some benefit for them, but it sure causes a lot of worry and concern when people see names they have chosen being ignored and reassigned/modified without any reasonable explanation as to why being presented to the user. On the practical end, there is absolutely no good way to prevent this renaming - either setting things up on the network router side or on OS X side given that the OS manage IPv4 and IPv6 and AirDrop and bluetooth networks and shuffle the network settings to accommodate many clients.