Skip to main content
DARKPC.NET
← All modules

Module 002 · 25 min

Your First Linux Terminal

Find your way around a pretend Linux terminal, then write and read a file.

Learn

Commands and output

A terminal lets you type instructions. A shell reads those instructions and prints the result. The prompt marks where to type. Leave out the prompt itself. A command that succeeds can be quiet. An error message gives you a clue about what to check.

Six commands to get started

pwd prints your current directory. ls lists what is inside it. cd changes directory (cd .. goes up one level). mkdir creates a directory. echo displays text. cat prints the contents of a text file.

Write a line to a file

In the exercise below, > sends the output of echo into a practice file. It replaces that file’s previous contents. Quotation marks keep words together. Paths and filenames are case-sensitive here.

Terminal practice

pwd
ls
mkdir projects
cd projects
echo "Hello, dragon!" > notes.txt
cat notes.txt
cd ..
ls

Practise

  1. Run pwd and ls. Find the starting directory and the file already in it.
  2. Follow the example to create projects, then create and read notes.txt. Check that the output matches the text you typed.
  3. Use cd .. to go back and run ls again. Try cat missing.txt and explain the error you see.

Practice terminal

Type one command and press Run. Use made-up text here. It works entirely in this page.

Starting directory: /home/learner
Type help for the list of commands.

Check your understanding

Completion checklist

Tick each item when you can do it. Finish the checklist to earn the Terminal Trailblazer badge.

Worksheet for module 002