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.
01

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.

learner@root-lab
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

learner@root-lab:~$ ls -la /srv
  1. 1learneruser
  2. 2root-labhost
  3. 3~current directory
  4. 4$normal user
  5. 5lsprogram
  6. 6-laoptions
  7. 7/srvargument
02

Read what was left for you

learner@root-lab
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.

03

Check which shell you are in

Your shell decides which commands and shortcuts exist. Its path is stored with your account.

learner@root-lab
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

CommandWhat it does
TabComplete a command or file name. Twice shows the choices
Up arrowBring back the previous command
Ctrl+CStop the command that is running
Ctrl+LClear the screen

What a defender takes away

  1. 1The prompt shows user, host and directory. Read it before every command.
  2. 2$ is a normal user and # is root.
  3. 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.

  1. Show hint

    Run cd with no arguments, then pwd.

  2. Show hint

    echo $SHELL