Can you please explain how the terminal prompt works?
It's your computer hostname. You can see and edit the value in "System Preferences -> Sharing -> Computer Name".

The prompt of the default shell (bash) can be changed by overriding the PS1 environment value.

# will show &gt;
export PS1='&gt;'

# will show the hostname followed by a space and &gt;
export PS1='\s &gt;'


These values are entered in a file called .bash_profile located in the root of your home directory (e.g., /Users/yourname/ or ~/). The period before the file name effectively hides it. You can read more about unix hidden files here.

You can see the complete list of special characters (e.g., \s) in the manual page of bash (your default shell).

Type man bash in the terminal and scroll down to the PROMPTING section. And if you'd like to unlock their potential, head on over to Prompt Magic and play around.