IT Course Directory: VMware, Linux, Networking, and Raspberry Pi

Linux Course Activities and Hands-On Practice

Practice essential Linux skills with safe activities covering navigation, files, permissions, processes, system information, packages, and networking.

Hands-on practice turns Linux commands from memorized syntax into usable skills. These activities are designed for beginning Linux learners, self-paced students, and instructors assigning introductory command-line work. Complete them in a disposable practice environment, observe the output, record what happened, and repeat an exercise with a small variation.

Before starting, review the Free Linux Course and use its curriculum to connect each activity with the underlying lesson.

How to Use These Activities

A terminal is the application that accepts text input and displays command output. A shell is the command interpreter running inside the terminal. A command asks the operating system to perform an action or display information.

For every activity:

  1. Read the goal before entering a command.
  2. Predict what the command should do.
  3. Run it in the practice environment and inspect standard output, standard error, and the exit status when useful.
  4. Record important output, errors, and questions.
  5. Repeat the task using a different valid path, filename, or option.
  6. Clean up temporary files and processes when the activity is complete.

Prepare a Linux Practice Environment

You need access to a Linux command-line environment and a user account. A virtual machine or container is convenient because it can be reset. A remote training system is also suitable if its rules permit the commands below.

Check that you are using a non-root account:

whoami
id

The root user can change almost any part of the system. sudo temporarily runs an approved command with elevated privileges. Ordinary file, text, and process exercises should not require sudo. When a lesson genuinely requires administration, verify the command first, understand its effect, and use the smallest necessary privilege.

Create a dedicated working directory under your home directory. The home directory is the personal starting area assigned to a user. The tilde character represents that directory in many shells.

mkdir -p ~/linux-activities/files
cd ~/linux-activities
pwd
ls -la

Expected evidence: pwd displays a path ending in linux-activities, and ls -la shows the files directory along with entries such as . and ...

Activity Checklist

ActivityConcepts PracticedCommands or ToolsExpected Evidence of Completion
Build a practice workspaceWorking directory, paths, directory creationpwd, ls, cd, mkdir, touchA directory tree exists under the learner's home directory and can be located again.
Create and search a notes fileText inspection, search, counting, redirectionprintf, cat, less, grep, wcThe learner can display selected content, find a matching line, and report a line count.
Change permissions safelyPermission fields, executable scriptsls -l, chmod, shThe owner execute bit is added and the learner-created script runs.
Manage a test processPID, jobs, foreground and background controlsleep, jobs, ps, killA learner-owned delayed process is identified and stopped.
Inspect the Linux systemUser, kernel, storage, memorywhoami, uname, df, freeSystem identity and resource summaries are recorded.
Check connectivityInterfaces, DNS, reachabilityip, getent, pingNetwork configuration and name-resolution results are distinguished from ping results.

Navigation and Filesystem Activities

The working directory is the directory a command uses by default. An absolute path starts at the filesystem root, such as /home/alex/linux-activities. A relative path starts from the current working directory, such as files/notes.txt. The names . and .. mean the current directory and its parent directory.

cd ~/linux-activities
pwd
mkdir -p practice/archive
touch practice/one.txt practice/two.txt
ls
ls -la
cd practice
pwd
cd ..
pwd
cd ~/linux-activities/practice/archive
pwd
cd ../..
pwd

Expected outcomes: mkdir -p creates missing parent directories, touch creates empty files, and ls -la includes hidden files. A hidden file is usually a filename beginning with a period; it is not automatically more secure or private.

Compare object types:

mkdir directory-example
touch file-example
ln -s file-example link-example
ls -l directory-example file-example link-example
file directory-example file-example link-example

A regular file stores data, a directory maps names to filesystem objects, and a symbolic link stores a path to another object. The link display commonly includes an arrow pointing to its target.

Remove only the objects created for this activity:

rm file-example link-example
rmdir directory-example
rm -rf practice

File Content and Text Processing Activities

Use a small, known file so that output is easy to verify. The redirection operator > sends standard output to a file and replaces existing content. The operator >> appends instead. Standard input is normally typed or read from a file, standard output is normal command output, and standard error reports diagnostics. A pipe, written |, sends one command's standard output to another command's standard input.

cd ~/linux-activities
printf 'Linux practice\nCommand-line activity\nLinux files\n' > files/notes.txt
cat files/notes.txt
printf 'A second observation\n' >> files/notes.txt
head -n 2 files/notes.txt
tail -n 2 files/notes.txt
less files/notes.txt
grep 'Linux' files/notes.txt
wc files/notes.txt
wc -l files/notes.txt
cat files/notes.txt | grep 'activity'

cat displays the complete file, head shows its beginning, and tail shows its end. less provides paginated viewing; press q to leave it. grep searches for text or patterns. wc can count lines, words, and bytes. The exact byte count depends on the text and its newline characters, so verify it rather than guessing.

Test redirection and standard error separately:

printf 'another result\n' > files/results.txt
printf 'appended result\n' >> files/results.txt
cat files/results.txt
ls files/missing.txt 2> files/error.log
cat files/error.log

Expected evidence: results.txt contains both lines, while the failed ls diagnostic is stored in error.log rather than normal output.

Permissions and Ownership Activities

File permissions control whether the user (owner), group, and others may read, write, or execute an object. Inspect a learner-created script:

cd ~/linux-activities
printf '#!/bin/sh\necho Hello from Linux\n' > files/hello.sh
ls -l files/hello.sh
chmod u+x files/hello.sh
ls -l files/hello.sh
./files/hello.sh

The first character of an ls -l result identifies the object type. The next nine characters are three permission groups: user, group, and others.

SymbolMeaningApplies ToExample
rRead contents or list namesUser, group, or othersr--
wModify contents; directory write permits changes to entriesUser, group, or others-w-
xExecute a file or enter a directoryUser, group, or others--x
-Permission is absentUser, group, or others---

chmod u+x changes permissions for the owner only. This is different from changing ownership. Use ls -l to inspect the owner and group; ownership changes normally require administrative authority and should not be attempted in this introductory practice area.

If execution is denied, inspect the mode and try the interpreter explicitly:

ls -l files/hello.sh
sh files/hello.sh

Reflection: What changed after chmod u+x? Why can a directory require execute permission even when its contents are readable?

Processes and Job Control Activities

A process is a running program. Each process has a process ID, or PID. A foreground job occupies the terminal until it finishes or is interrupted. A background job continues while the shell accepts more commands.

sleep 300 &
jobs
ps -ef | grep '[s]leep 300'
kill %1
jobs
ps -ef | grep '[s]leep 300'

The ampersand starts sleep in the background. jobs reports jobs controlled by the current shell; ps displays processes and their PIDs. In the example, %1 means job number 1. If you instead obtain a PID, use kill PID with that number.

A normal kill requests graceful termination, giving a process an opportunity to clean up. A forced signal such as kill -9 PID stops a process immediately and should be a last resort. Stop only processes owned by you and confirm that the command is the harmless test process you started.

Try foreground control with a new test command:

sleep 60
# Press Ctrl+Z to suspend it
bg
jobs
fg

After fg, press Ctrl+C to interrupt the test command. Do not use these controls on an unknown production process.

Package and System-Information Activities

Inspect basic system details without changing the system:

whoami
uname -a
df -h
free -h

Record the current user, operating-system kernel information, available disk space, and memory summary. df -h reports filesystem space in human-readable units; free -h reports memory and swap values.

A package manager obtains software packages from configured repositories, resolves dependencies, and tracks installed files. Distribution families use different tools. Common examples include apt, dnf, yum, pacman, and zypper. Search or display package information before considering installation:

command -v apt dnf yum pacman zypper
apt search shell 2>/dev/null
apt show bash 2>/dev/null
dnf search shell
dnf info bash

Use only the commands supported by your distribution, and do not run multiple package-manager commands at once. Installation, removal, repository changes, and system upgrades can require sudo and can affect the whole machine. Package names, options, metadata commands, and repository configuration vary by distribution.

Networking and Remote Access Activities

A hostname is a human-readable system or service name. An IP address identifies a network interface or endpoint. Inspect local interfaces:

ip addr
getent hosts example.com
ping -c 2 example.com

ip addr displays local interfaces and addresses. getent hosts tests name resolution through the system's configured name-service mechanism. ping tests reachability using ICMP where permitted; a failed ping does not prove that the host is offline because firewalls may block ICMP.

SSH, the Secure Shell protocol, provides encrypted remote command-line access and can authenticate users with passwords or keys. Use a placeholder host only when your training provider supplies a real destination:

ssh learner@training-host.example

Do not guess credentials, scan hosts, or connect to systems without permission. A first connection may ask you to verify the server's host key. Check that fingerprint through a trusted training instruction before accepting it.

Common Linux Command Categories

CategoryRepresentative CommandsTypical Learner TaskNotes on Safety or Permissions
Navigationpwd, cd, lsLocate and inspect directoriesUsually safe; verify paths before destructive commands.
Filesmkdir, touch, cp, mv, rmCreate and organize practice dataUse a dedicated directory; be cautious with recursive removal.
Textcat, head, tail, grep, wcInspect, search, and summarize textRedirection can replace files when using >.
Permissionsls -l, chmodInspect and modify learner-owned modesAvoid changing system ownership or permissions.
Processesps, jobs, killObserve and stop test processesTarget only processes you own and recognize.
System informationwhoami, uname, df, freeCollect system and resource factsRead-only inspection normally needs no sudo.
Networkingip, getent, ping, sshInspect identity and test permitted connectivityFollow network-use rules and obtain authorization.

Troubleshooting and Checkpoints

File or directory does not exist

Check the current location with pwd, list nearby entries with ls -la, and look for spelling or letter-case errors. Use tab completion or an absolute path when a relative path is ambiguous.

Permission denied when executing a script

Inspect the mode with ls -l. For a script you created, use chmod u+x scriptname. If execution restrictions apply to the filesystem, run an explicit interpreter such as sh scriptname when appropriate.

An administrative command fails

Do not automatically add sudo. The task may not need elevated access, your account may not be authorized, or the training environment may prohibit administration. Ask the environment administrator before changing system configuration.

A process cannot be found or stopped

It may have already ended, or the PID or job number may be wrong. Refresh with ps or jobs. A process belonging to another user may not be yours to stop. Try a normal termination signal before considering stronger methods.

A network test fails

Inspect interfaces with ip addr. Test DNS separately with getent hosts. Firewalls, disabled networking, and blocked ICMP can produce different results, so do not interpret a failed ping by itself as proof of unavailability.

Review and Self-Assessment

After each activity, reset the practice area where possible: remove temporary files, end background jobs, and restore a clean virtual machine or container snapshot if one is available. Keep a short activity log containing the command, observed output, error messages, and your explanation of the result.

Answer these questions without looking at the command list:

  • What is the difference between an absolute path and a relative path?
  • How can you display hidden files, and why might they matter?
  • What is the difference between overwriting output with > and appending with >>?
  • How do standard output, standard error, and a pipe differ?
  • Which permission field changed after chmod u+x?
  • What is a PID, and how is it different from a shell job number?
  • Why should package installation and ownership changes be treated more cautiously than reading system information?
  • Why should name resolution and network reachability be tested separately?

For further structured practice, continue with the Linux course activity index and compare these exercises with related lessons on network fundamentals and network discovery concepts.