basic Linux commands practice Fedora terminal exercises

Basic Linux commands practice — navigate Fedora for real

In the previous article we covered the basic Linux commands you need for IC2. Now it’s time to actually use them. This article has three practical exercises you do directly in your Fedora terminal, no reading, just typing. By the end you’ll have built a complete working directory structure for IC2 and navigated your way around Fedora confidently.

Open your Fedora terminal before starting. All exercises are done there.

How this practice works

Each exercise gives you a goal and a set of commands to try. Type every command yourself, don’t copy and paste. The muscle memory of typing commands is part of learning them. If you make a mistake, that’s fine, the terminal tells you what went wrong and you try again.

Before starting any exercise always run:

pwd

To confirm where you are. Getting lost in the file system is the number one beginner frustration, pwd is the cure.

Basic Linux commands practice — Exercise 1: Explore the Fedora file system

The goal: navigate around the Fedora file system and understand what’s where. You’re not creating or deleting anything, just looking.

Start from your home directory:

cd ~
pwd

Output:

/home/sergio

List everything in your home directory including hidden files:

ls -la

You’ll see files starting with ., these are hidden configuration files. .bashrc is your shell configuration. .bash_history is your command history. Don’t delete them.

Now explore some system directories:

# Go to the root
cd /
ls

# See what's in /home
ls /home

# See what's in /etc (system configuration)
ls /etc | head -20    # | head -20 shows only first 20 lines

# See what programs are installed
ls /usr/bin | head -30

Find out how much disk space you have:

df -h               # disk usage — h = human readable (GB, MB)
df -h ~             # just for your home directory

Find out how much RAM you have:

free -h             # memory usage — h = human readable

See what processes are running:

ps aux | head -20   # all running processes, first 20

Go back home:

cd ~
pwd

What you just did: navigated through the Linux file system, saw the difference between user space (/home) and system space (/etc, /usr/bin), and used your first pipe (|) to filter command output.

Basic Linux commands practice — Exercise 2: Build your IC2 folder structure

The goal: create a complete, organised folder structure for IC2 using only terminal commands.

Start from your home directory:

cd ~
pwd

Create the main GCID folder and the complete IC2 structure in one command:

mkdir -p ~/GCID/IC2/Labs
mkdir -p ~/GCID/IC2/Notes
mkdir -p ~/GCID/IC2/Assignments
mkdir -p ~/GCID/IC2/Labs/Lab1_intro
mkdir -p ~/GCID/IC2/Labs/Lab2_variables_c
mkdir -p ~/GCID/IC2/Labs/Lab3_pointers

Verify it was created correctly:

ls -R ~/GCID

The -R flag lists recursively, it shows all directories and their contents. You should see your complete tree.

Now create some starter files:

cd ~/GCID/IC2/Labs/Lab1_intro
touch main.c
touch README.txt
ls -l

Add some content to the README:

echo "Lab 1 — Introduction to C" > README.txt
echo "Student: Sergio Medina" >> README.txt
echo "Date: $(date)" >> README.txt
cat README.txt

Output:

Lab 1 — Introduction to C
Student: Sergio Medina
Date: Sat Jun  7 11:23:45 CEST 2025

echo prints text. > redirects output to a file (overwrites). >> appends to a file (adds at the end). $(date) runs the date command and inserts its output.

Now practice copying and moving:

# Copy main.c to Lab2
cp ~/GCID/IC2/Labs/Lab1_intro/main.c ~/GCID/IC2/Labs/Lab2_variables_c/

# Verify
ls ~/GCID/IC2/Labs/Lab2_variables_c/

# Rename the copy
mv ~/GCID/IC2/Labs/Lab2_variables_c/main.c ~/GCID/IC2/Labs/Lab2_variables_c/variables.c

# Verify
ls ~/GCID/IC2/Labs/Lab2_variables_c/

Create a backup of Lab1:

cp -r ~/GCID/IC2/Labs/Lab1_intro ~/GCID/IC2/Labs/Lab1_intro_backup
ls ~/GCID/IC2/Labs/

Now delete the backup (practice with -i for safety):

rm -ri ~/GCID/IC2/Labs/Lab1_intro_backup

The -i flag asks for confirmation before deleting each item, type y to confirm. This is the safe way to practice rm.

What you just did: created a real working directory structure using mkdir -p, created files with touch and echo, redirected output with > and >>, copied and moved files and directories, and used rm -ri safely.

Basic Linux commands practice — Exercise 3: The terminal mini challenge

The goal: complete a series of tasks using only terminal commands. No graphical file manager allowed.

Set up the starting state:

cd ~
mkdir terminal_challenge
cd terminal_challenge
touch file1.txt file2.txt file3.txt file4.txt file5.txt
ls

Task 1: Rename file1.txt to important.txt

mv file1.txt important.txt
ls

Task 2: Create a folder called archive and move file3.txt and file4.txt into it

mkdir archive
mv file3.txt file4.txt archive/
ls
ls archive/

Task 3: Make a backup copy of important.txt called important_backup.txt

cp important.txt important_backup.txt
ls

Task 4: Add your name to important.txt and verify the content

echo "This file belongs to Sergio Medina" > important.txt
cat important.txt

Task 5: Check the total size of the challenge folder

cd ~
du -sh terminal_challenge/

du shows disk usage. -s gives a summary total. -h makes it human readable.

Task 6: List all .txt files in the challenge folder and its subfolders

find terminal_challenge/ -name "*.txt"

find searches for files matching a pattern. -name "*.txt" matches any file ending in .txt. The * is a wildcard — it matches any sequence of characters.

Task 7: Delete the challenge folder when done

cd ~
pwd               # confirm you're in home, not inside the folder
ls terminal_challenge/    # check what you're about to delete
rm -ri terminal_challenge/

Always check pwd and ls before rm -r. In this case you’re deliberately deleting practice files, but build the habit now for when it matters.

Common mistakes you probably made

If you got an error during these exercises, here’s what likely happened:

# "No such file or directory"
cd GCID      # GCID doesn't exist yet, or you're not in ~
cd ~         # go home first, then try again

# "Permission denied"
rm /etc/hosts    # you don't have permission to delete system files
# Only delete files in your home directory ~/

# "Is a directory"
rm MyFolder/     # can't rm a directory without -r
rm -r MyFolder/  # correct

# Command seems to do nothing
cp main.c       # missing destination
cp main.c .     # correct — copy to current directory

Building the habit

After these three exercises you should have a feel for the rhythm of terminal work:

pwd → ls → cd → do something → ls → verify

Always check where you are, see what’s there, do the operation, verify it worked. That rhythm becomes automatic after a week of IC2 and from there the terminal stops feeling intimidating.

Summary — what you practised

# EXPLORATION
ls -la          # detailed listing with hidden files
ls -R           # recursive listing
df -h           # disk space
free -h         # RAM usage

# CREATE STRUCTURE
mkdir -p a/b/c  # create full path at once
touch file.c    # create empty file
echo "text" > file.txt    # create file with content
echo "text" >> file.txt   # append to file

# NAVIGATE AND VERIFY
pwd             # where am I?
ls folder/      # what's inside a specific folder?
cat file.txt    # show file contents

# COPY AND MOVE
cp file copy             # copy file
cp -r folder backup/     # copy directory
mv file newname          # rename
mv file folder/          # move

# DELETE SAFELY
rm -i file       # delete with confirmation
rm -ri folder/   # delete directory with confirmation

# SEARCH
find folder/ -name "*.c"    # find all .c files
du -sh folder/              # total size of folder

# FILTER OUTPUT
command | head -20   # show only first 20 lines
command | grep word  # show only lines containing word

# GOLDEN SEQUENCE BEFORE rm
pwd              # 1. check where you are
ls               # 2. check what's there
rm -ri target    # 3. delete with confirmation

In the next article you’ll find exercises to solve on your own, including a directory reorganisation challenge and a file search task.

Similar Posts

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *