COMPUTING FOUNDATIONS · GUIDED LESSON

Linux: from kernel to command line

Understand distributions, inspect your environment and complete a small file exercise in your own practice folder.

Read the explanation, work through the example and answer the practice questions before taking the knowledge check.

What you will learn

  • Distinguish a kernel, distribution, terminal and shell.
  • Identify the operating-system release and current directory.
  • Create, read and inspect a practice file without administrator access.

Kernel and distribution

Linux is a kernel: it manages hardware resources and provides interfaces used by programs. A distribution combines a kernel with user-space tools, libraries, package management and often a desktop environment.

Ubuntu and Debian are distributions. A terminal presents a text interface. A shell reads command lines and runs commands; Bash is one example. A graphical desktop and a command line can use the same underlying system.

A minimal container may provide user-space files while sharing a host kernel. WSL environments also differ by version and configuration. Do not assume that every Linux-like shell has a full systemd service manager.

Choose a practice environment

Use an existing personal Linux environment, a virtual machine, or a Linux environment supplied for a course. On Windows, WSL provides a way to use Linux tools. A virtual machine provides a separate guest operating system. A live USB can boot a desktop without a normal installation, although creating the USB overwrites the selected USB device.

This lesson starts with an available Linux shell. It does not ask you to repartition a disk or replace your current operating system. If you are on a production server, use the browser service exercise later instead of experimenting with services there.

Find out where you are

Run these separately in a Linux shell:

pwd
uname -r
cat /etc/os-release

pwd prints the current working directory. uname -r reports a kernel release. The release file describes the distribution user space. The exact output depends on the environment; a kernel name alone does not identify the distribution.

Paths beginning with / are absolute. Other paths are interpreted relative to the current directory. Your home directory is commonly represented by ~; $HOME expands to its path in the shell.

Worked example: a practice file

This exercise uses a newly created directory under your home directory. It needs no sudo. Run one line at a time:

practice_dir=$(mktemp -d "$HOME/hamtron-learn.XXXXXX")
cd "$practice_dir"
printf '%s\n' 'Hello from HamTron Learn' > greeting.txt
cat greeting.txt
ls -l greeting.txt

mktemp -d creates a fresh directory and prints its path; the assignment records that path in practice_dir. The quoted expansion passes it to cd as one argument. printf produces text and > writes it into greeting.txt. The fresh directory avoids overwriting an existing file of that name. cat reads the file, and ls -l shows file metadata.

The text should be Hello from HamTron Learn. File sizes and timestamps depend on the actual contents and host. Your folder remains available after the exercise. Later, cd "$HOME" returns you to your home directory.

Permissions and command failures

File permission bits describe access for an owner, group and others. A command can fail because a file is absent, a path is wrong, access is restricted or a required command is not installed.

If cat greeting.txt says the file does not exist, inspect pwd and ls first. Running an unrelated command with sudo does not fix being in the wrong directory. Avoid sharing output that contains private paths or file contents.

Next, use the guided systemd service exercise. The systemd library supplies reference detail after the concepts are familiar.

Practice and explained answers

Work out each answer before expanding it. Use the explanations and worked examples on this page.

Why might uname and /etc/os-release describe different aspects of an environment?

uname reports the running kernel; os-release describes the distribution user space. Containers can share a host kernel.

What does the > character do in this exercise?

The shell redirects output into a file. It can truncate an existing file, which is why the exercise creates a fresh directory first.

You opened a new shell and greeting.txt is not found. What should you check?

Check the current working directory and locate the practice directory. The shell variable from a previous shell may no longer be set.

COMPUTING FOUNDATIONS · STEP 3 OF 13

Check what you learned

Answer both questions correctly to complete this step. You can revise your answers and retry.

1. Which command reports the current working directory?
2. Why does the file exercise create a fresh directory?

Progress stays in this browser. It is not synced to an account or sent as analytics. Passing these introductory checks is not certification.

Editorial credits

Original lesson and exercises prepared for HamTron Learn. Updated 17 November 2026. This is introductory educational material, not a qualification or certification.

Return to Half Echo Learn