This step covers what each part of the prompt means and where it comes from.
Before the @ is the user the shell runs as — whoami prints it. A user is a user account: a login name and the rights attached to it.
Between @ and : is the machine name, which hostname prints. The machine got the name ubuntu by default from the Ubuntu image; real servers have names of their own, such as web-01.
After the : is the current directory: the place the shell counts file names from. Every account has a home directory for personal files; for student it is /home/student. In the prompt the shell shortens it to ~, while pwd prints the current directory in full. You will learn to move between directories in the navigation lesson.
The prompt reads student@ubuntu:/etc$. What will pwd print?
-
Inside the home directory the prompt would start the path with
~. Here the colon is followed by/etc, a directory outside home. -
The prompt would show the home directory as
~. The colon is followed by/etc: the shell is working in another directory. -
The shell draws
~only in the prompt;pwdnever prints it. And this prompt has no~at all.
After the colon the prompt shows the current directory. Only the home directory gets the ~ shorthand; /etc lies outside it, so the prompt and pwd write it the same way.
Key points
-
Before
@is the user, between@and:the machine, after:the current directory. -
~in the prompt is the home directory;pwdprints the current directory in full.