Terminal-App: What’s in front of colon and why does it change with a different network? [duplicate]
When I open the terminal-app, there is this default code. However, it changes depending on the network:
This is how it looks like in my local coworking office:
Last login: Thu Aug 13 14:49:57 on ttys000
HUAWEI_P20-12345678:~ user$
This is how it looks like at home or with wlan disconnected:
Last login: Thu Aug 13 14:51:36 on ttys000
MyMac:~ user$
I don't know what a HUAWEI P20 should be? I have an iPhone and I can't believe that the coworking office has a cellphone as router?
Did my computer get hacked?
What does this line mean and what difference does it make?
Furthermore, what does ttys000 mean?
btw, MyMac is obviously the name of my computer and I replaced my username with "user".
Solution 1:
The string you see at the beginning of every line of Terminal
is not a function of the Terminal
application but a feature of any shell on any Unix system.
This string is defined as PS1 = Prompt String n°1.
On most shell this string is defined as containing your hostname as you can get it with the basic command hostname
.
Of course, your hostname depend on your method of connection, your ISP, and how your computer name can be established from your DNS servers (Domain Name System).
When your computer doesn't have a connection established to the Internet, this name is its local name as you have defined it in System Preferences > Sharing > Computer Name:
.
The last component of the line showing you how you connected
the last time you did is the terminal from which you were
connected on your Mac. Each shell session has a virtual terminal on which your shell commands are runs. This is the final part of the terminal name you were using as shown with the command tty
.
If the Last login:
information looks right to you, then it means your computer wasn't pirated and used by
a criminal.