Unit 1: The shell and the filesystem · Lesson 1 of 5 · 16 min
Reading the prompt
Find out who you are, where you are and what happens when you press Enter.
mission
- You are
- You are the new admin of web01, the Example Shop web server.
- Situation
- The previous admin left yesterday. You have a terminal and nothing else.
- Goal
- Confirm which account you are using, on which machine, and where you are standing.
- Hand in
- Your user name, the machine name and your home directory.
Ask the machine who you are
Before you change anything on a server, confirm the account and the host. Admins who skip this run commands on the wrong machine.
whoami learner hostname root-lab pwd /home/learner
you should see The same three facts the prompt already shows: learner, root-lab and ~, which is short for /home/learner.
defender tip The last character of the prompt matters. $ means a normal user. # means root, where every typo counts.
The prompt and a command, part by part
- 1
learneruser - 2
root-labhost - 3
~current directory - 4
$normal user - 5
lsprogram - 6
-laoptions - 7
/srvargument
Read what was left for you
ls README.txt cat README.txt Welcome to your lab machine. This server runs the company website. You are taking it over from the previous admin. Work through the units in order and answer the questions from what you find here. Nothing on this machine can reach the internet.
you should see One file. cat prints it in full, which is fine for a short text file.
Check which shell you are in
Your shell decides which commands and shortcuts exist. Its path is stored with your account.
echo $SHELL /bin/bash getent passwd learner learner:x:1000:1000::/home/learner:/bin/bash
you should see /bin/bash in both places. The second line is your account record, which the users unit takes apart.
Keys that save time
| Command | What it does |
|---|---|
Tab | Complete a command or file name. Twice shows the choices |
Up arrow | Bring back the previous command |
Ctrl+C | Stop the command that is running |
Ctrl+L | Clear the screen |
What a defender takes away
- 1The prompt shows user, host and directory. Read it before every command.
- 2
$is a normal user and#is root. - 3bash finds the program, the kernel runs it as you and checks your permissions.
Questions
0 of 2 solved
Answer each one from what you find on your lab machine.