Recommended resources
The freely available resources this lesson will direct you to.
Hello! In the previous lesson, you set up Ubuntu under WSL 2 and created ~/cloud-labs. Now you’ll learn to move around that Linux workspace and organize its files. By the end, you should be able to choose the right path, create and rearrange files and directories, and use glob patterns without accidentally targeting more than you intended. Allow about 40–45 minutes, including time at your Ubuntu terminal.
Know where a command will act
A Linux shell always has a working directory: the location from which it interprets paths that do not specify a starting point. Before changing or deleting files, make a habit of checking it with pwd.
Watch the short demonstration first. The presenter’s folder names are only examples; you’ll use your own lab workspace below.
Watch “Basic Linux Navigation” by Nathan Backman for a visual introduction to the prompt, working directory, ls, mkdir, and cd.
Watch the prompt for the meaning of the current location and ~, then the folder demo for listing, creating, and entering a directory. Focus on how the prompt changes after cd; use pwd whenever you want an unambiguous answer.
Open Ubuntu, not PowerShell, and try:
cd ~/cloud-labs
pwd
ls
cd changes your working directory; pwd prints its full path; ls lists what is there. A successful cd usually prints nothing. If ~/cloud-labs is missing, recreate the workspace with mkdir -p ~/cloud-labs, then repeat the commands.
Linux paths use / as a separator. The first slash in an absolute path means “start at the filesystem root.” For example, /etc identifies the same directory regardless of where you currently are. A relative path starts at your working directory: from ~/cloud-labs, scripts/check.sh would mean a file inside a scripts directory there. It will mean something different if you run it from elsewhere.
Three shortcuts make paths easier to use:
~at the start of a path means your home directory.cdwith no argument also takes you home..means the current directory...means the parent directory;cd ..goes up one level.
For example, after cd ~/cloud-labs, cd .. takes you to your home directory. cd ~/cloud-labs takes you straight back, wherever you started. You can inspect a directory without entering it: ls ~/cloud-labs lists its contents but does not change your working directory.
In WSL, your Windows C: drive is accessible under /mnt/c, but keep these Linux-tool labs under ~/cloud-labs, as you did in the previous lesson. Also remember that Linux names are case-sensitive: Main.tf and main.tf are different names.
Build a small practice workspace
Use a new directory so the commands in this lesson cannot overwrite an existing lab. From Ubuntu, run the following only if filesystem-practice does not already exist. If it does, choose a fresh name and use that name throughout.
cd ~/cloud-labs
mkdir filesystem-practice
cd filesystem-practice
pwd
The printed path should end in /cloud-labs/filesystem-practice. In particular, check that it does not begin with /mnt/c.
The Ubuntu command-line tutorial explains why mkdir -p is useful for nested directories. Read its directory-creation example before building yours.
The Linux command line for beginners
Read the “Creating folders and files” section of Ubuntu’s tutorial to see how directory arguments and the -p option work.
In Section 4, “Creating folders and files,” find the paragraph beginning “Back to our new directories,” after the tutorial creates its /tmp/tutorial area. Read the directory example, including mkdir -p dir4/dir5/dir6. Stop after the explanation that options change a command’s behavior. The tutorial uses a different practice area; keep using ~/cloud-labs/filesystem-practice here.
Create a few directories resembling an infrastructure project. These .tf and .sh files are empty placeholders, not working Terraform configuration or scripts:
mkdir -p terraform/dev terraform/prod scripts archive
touch terraform/dev/main.tf terraform/dev/variables.tf terraform/dev/outputs.tf
touch terraform/dev/notes.txt scripts/check.sh scripts/deploy.sh scripts/notes.txt
touch .lab-note
ls -F
mkdir -p creates missing parent directories, so one command can make terraform/dev. touch creates an empty file if it does not exist; on an existing file, it updates its timestamp rather than clearing its contents. The -F option makes ls mark directories with a trailing /.
Why didn’t .lab-note appear? Names beginning with . are hidden from an ordinary ls listing. Compare:
ls -a
ls terraform/dev
ls -a includes hidden names, as well as the special entries . and ... Hidden does not mean secure; the next lesson addresses how permissions protect files.
Copy, move, and rename deliberately
Think of file-management commands as taking a source and a destination. The destination may be a directory, or it may be a new filename. Ubuntu’s tutorial works through both possibilities.
The Linux command line for beginners
Continue in Ubuntu’s tutorial to see how mv and cp work with paths, including how mv doubles as a rename command.
In Section 5, “Moving and manipulating files,” start just after the first mv combined.txt dir1 example, at “You can confirm that the job has been done.” Read copy and move through the paragraph explaining a rename’s two arguments. Focus on when the final argument is an existing directory versus a new filename. Stop before the examples renaming folders with spaces.
Apply those ideas in your sandbox:
cp terraform/dev/variables.tf terraform/prod/variables.tf
cp -r terraform/dev terraform/dev-copy
mv scripts/check.sh scripts/audit.sh
mv terraform/dev/notes.txt archive/
The first cp leaves the original in dev and makes another file in prod. Copying a directory and its contents requires cp -r; here it creates terraform/dev-copy. The first mv renames a file, while the second moves a file into an existing directory. Neither mv leaves the original in its old location.
Check the result rather than relying on a silent command:
ls terraform/dev
ls terraform/prod
ls terraform/dev-copy
ls scripts
ls archive
You should find variables.tf in both dev and prod, audit.sh in scripts, and notes.txt in archive. You can inspect all these paths while remaining in filesystem-practice.
Pause before copying or moving onto a name that already exists. A plain cp or mv can replace a destination file. In a real infrastructure project, inspect the destination first, especially when moving configuration or scripts.
Use glob patterns to select names
Typing every filename becomes tedious as a project grows. In Bash, a glob pattern lets the shell expand one argument into matching pathnames before the command runs. The command then receives those names as its arguments. Watch the basic patterns; you do not need the video’s advanced shell settings for this lesson.
What The GLOB?! Filename Expansion in Linux 📦
Watch “What The GLOB?! Filename Expansion in Linux” by NIX tricks for demonstrations of the three basic wildcard forms.
Watch star and question to distinguish “any number of characters” from “exactly one character.” Then watch bracket matches for choosing one character from a set. Apply the patterns to the filenames in your practice workspace rather than the video’s images.
From filesystem-practice, run these listing-only commands:
ls terraform/dev/*.tf
ls terraform/dev/????.tf
ls terraform/dev/[mo]*.tf
ls scripts/*.sh
Here, * matches zero or more characters, ? matches exactly one, and [mo] matches either m or o at that position. Thus terraform/dev/????.tf selects main.tf, whose name has four characters before .tf; [mo]*.tf selects main.tf and outputs.tf. The .tf pattern does not reach into terraform/prod: these globs match names at the path level you specified, not every file under terraform.
The terminal image shows the same distinction with text files: ls lists everything in the current directory, whereas ls *.txt lists names there that end in .txt.

Globs match names, not file contents, and they are not regular expressions. Bash normally does not include dot-prefixed names such as .lab-note in a * match. If a glob has no matches, ordinary Bash generally leaves the pattern unchanged, so a command such as ls *.tf from your practice directory may report that it cannot find a file literally named *.tf; your .tf files are one directory deeper.
This matters most with changes rather than listings. Before using a glob with mv or rm, check pwd and preview the exact pattern with ls. A space can dramatically change the arguments: rm t* and rm t * do not request the same deletion.
Remove only what you have checked
Deletion is the operation least forgiving of a path mistake. Ubuntu’s tutorial distinguishes removing files, empty directories, and directories with contents.
The Linux command line for beginners
Finish the file-management portion of Ubuntu’s tutorial for its safety guidance on rm, rmdir, recursive deletion, and wildcards.
In Section 5, find the subsection “Deleting files and folders.” Begin after its initial reminder to run pwd, at “Now we know how to move, copy and rename files and directories.” Read the deletion guidance through the final warning about wildcard arguments and the -i interactive option. Notice that rmdir only removes empty directories, while rm -r also removes their contents.
Back in your practice directory, verify your location and the file to remove:
pwd
ls archive
rm -i archive/notes.txt
rmdir archive
For rm -i, confirm removal only when the prompt names the intended practice file. Once that file is gone, archive is empty, so rmdir can remove it. rm does not send files to a graphical Trash folder.
You can also remove the copied practice directory, but inspect it first:
ls -a terraform/dev-copy
rm -ri terraform/dev-copy
ls terraform
-r permits removal of a directory and its contents; -i asks for confirmation as it proceeds. Read each prompt and answer only if it refers to the copied directory or its files. Press Ctrl-C to stop if anything looks wrong. Avoid using recursive removal on a broad glob or a path you have not checked.
Wrap-up
You can now locate yourself with pwd, inspect directories with ls, navigate using absolute and relative paths, and manage files with mkdir, touch, cp, mv, rm, and rmdir. Bash globs make selecting filenames efficient, but the same expansion makes an unchecked deletion dangerous. Keep the habit of confirming your working directory and previewing matches.
Next, you’ll examine ownership and permissions: being able to find a script or credential file is only part of managing it; you also need to control who may read, change, or execute it.