Skip to main content
Techlogia — AI and Web Development Berlin
All courses
Free to read – no sign-up

Linux Console

First steps with the Linux shell. Create files, move them, write content. 5 tasks.

Duration: 20 minLevel: BeginnerExercises: 5

First steps in the console

First steps with the Linux console

The console (also terminal or shell) is the text-based way to control a Linux computer: you type commands, the computer runs them. Professionals do almost everything via the console because it is fast and automatable.

Key terms & commands

  • Directory: a "folder". You move around with cd, create one with mkdir.
  • echo: prints text — with > you write it into a file.
  • cat: shows the content of a file.
  • ls: lists files in a directory.

Work in the folder /home/student/uebung/ in this lesson. Create it first: mkdir -p /home/student/uebung.

Your goal

You create files, write text into them and practise the basic commands — the foundation for all further modules.

Exercises

  1. 1. Create your first file

    Concept: creating a file with >. The arrow > redirects a command's output into a file (overwriting it). This lets you create a file with content in one step.

    Create the practice folder and write hallo into a file:

    mkdir -p /home/student/uebung
    echo "hallo" > /home/student/uebung/hallo.txt

    Check with cat /home/student/uebung/hallo.txt.

    Check: /home/student/uebung/hallo.txt contains the word hallo.

  2. 2. Your name in a file

    Concept: appending lines with >>. While > overwrites, >> appends to a file. This lets you write multiple lines.

    Write your first and last name on two lines into ich.txt:

    echo "Max" > /home/student/uebung/ich.txt
    echo "Mustermann" >> /home/student/uebung/ich.txt

    Replace the example names with your own.

    Check: /home/student/uebung/ich.txt contains at least two lines.

  3. 3. Write a list

    Concept: writing a list. In many text formats a list item starts with a hyphen and space (- ). Write a list with at least three items into liste.txt.

    printf -- "- Apple\n- Banana\n- Cherry\n" > /home/student/uebung/liste.txt

    printf with \n creates line breaks. Alternatively write it by hand with nano.

    Check: /home/student/uebung/liste.txt contains at least three lines starting with - .

  4. 4. Uppercase

    Concept: transforming text with tr. The command tr (translate) replaces characters — e.g. lower- to uppercase. Write a word in UPPERCASE (at least 5 letters) into laut.txt.

    echo "warning" | tr 'a-z' 'A-Z' > /home/student/uebung/laut.txt

    Result: WARNING. tr 'a-z' 'A-Z' converts each lowercase letter to the corresponding uppercase one.

    Check: /home/student/uebung/laut.txt contains at least 5 uppercase letters in a row.

  5. 5. Create three files

    Concept: multiple files & ls. Create three files, then write an overview of their names into drei.txt — combining touch (create an empty file) and ls (list).

    cd /home/student/uebung
    touch a.txt b.txt c.txt
    ls *.txt > drei.txt

    touch creates empty files; ls *.txt > drei.txt writes the list into the file.

    Check: /home/student/uebung/drei.txt is not empty (contains the file names).

Related courses

Now practice it yourself

Reading is good – doing is better. Start this course on a real Linux VM, right in your browser. A free account is all it takes.

Start for free

Lab content under CC BY 4.0 – free to use with attribution (© TechLogia).

How do you like this page?

Linux Console | Techlogia Lab