>_ IzzyLab

Hands-on task

This task is step 1 of the course “First steps in Linux”

Look around the server

easy~5 min

You're on this server for the first time. The previous admin left a note in the /root/office directory — an ordinary text file. Find it, read it and do what it says.

Write your answer to /root/answer.txt with a command like this: echo word > /root/answer.txt — just put what you find in place of word.

What you'll practise:
  • pwd
  • ls
  • cd
  • cat
  • file paths

Topic breakdown

All files in Linux live in one big tree of directories. Its top is the root, /, and a path is a file's address in that tree: /etc/hostname means "in the root, the directory etc, and in it the file hostname".

A path that starts with / is absolute: it works from anywhere. A path without a leading / is relative: it's counted from the directory you're currently in. .. is the directory one level up.

Four commands to look around:

pwd            # where am I? e.g. /root
ls /etc        # what's in /etc
cd /etc        # go to /etc
cat hostname   # show the file hostname — a relative path, from /etc

You type commands into the shell (here it's bash) — a program that reads a line, runs the command and shows you the result.

Tip: start typing a file or directory name and press Tab — the shell will complete it for you.

What's checked

  1. File /root/answer.txt created
  2. The file holds the code word from the note

What it looks like