Build a workspace you can trust
By the end: Create, copy, rename, inspect, and remove your own practice files deliberately.
The idea
Work in a fresh temporary directory, not your application repository. The lab creates its own files. Copy preserves the original; move changes its location or name. Deletion normally bypasses the desktop trash. Inspect a path first, and use an interactive confirmation when learning.
Your command toolkit
mkdir
What it solves: Create a directory structure.
mkdir -p project/notes
-p creates missing parents and accepts existing directories. It does not empty them.
touch
What it solves: Create an empty file or update timestamps.
touch project/notes/ideas.txt
An existing file keeps its contents. touch is not a way to clear a file.
cp
What it solves: Make a separate working copy.
cp -i notes.txt notes-copy.txt
-i asks before overwriting an existing destination. Use -r for directories, and inspect the destination layout afterward.
mv
What it solves: Rename a file without duplicating it.
mv -i notes-copy.txt revised-notes.txt
A move can replace another file. -i makes that decision visible during practice.
rm
What it solves: Remove a file you no longer need.
touch disposable.txt
rm -i -- disposable.txt
This removes only a practice file after confirmation. -- ends option parsing. Avoid recursive deletion until you have verified every target.
rmdir
What it solves: Remove an empty directory.
mkdir empty-practice
rmdir empty-practice
rmdir refuses a nonempty directory, which makes it useful for cautious cleanup.
ln
What it solves: Create another path to a file.
ln -s notes.txt notes-link.txt
A symbolic link stores a target path. Here the relative target is resolved from the link's directory; moving the target can break the link.
basename
What it solves: Extract a filename from a path.
basename /tmp/report.txt .txt
Prints report. This edits the path string; it does not access, move, or rename a file.
stat
What it solves: Inspect ownership, sizes, and timestamps.
stat notes.txt
A file's change time describes metadata changes, not creation. Available timestamp fields depend on the filesystem.
tree
What it solves: See a bounded directory map.
tree -L 2 .
Shows two levels so a large directory does not overwhelm the terminal. tree is optional on many distributions.
Before you move on
Try the guided lab below. Compare the result with the explanation, then record your reasoning in the workbook. A missing optional program or a restricted environment is something to explain, not a reason to change system settings blindly.
Practice with evidence
- Predict the result
- Run the guided lab
- Compare the output
- Explain your choice
A worked example
Guided lab
si_lab=$(mktemp -d)
cd "$si_lab" || exit
printf 'First idea\n' > notes.txt
mkdir -p project/notes
cp notes.txt project/notes/ideas.txt
mv project/notes/ideas.txt project/notes/draft.txt
ln -s notes.txt notes-link.txt
ls -l notes-link.txt project/notes/draft.txt
What to expect: A symbolic link to notes.txt and a separate draft.txt inside project/notes. The original notes.txt still exists.
Make it yours: Draw the resulting directory tree in words. Explain what would happen to the copy and the symbolic link if the original were renamed.
Read further
- GNU Coreutils manual ↗www.gnu.org
Apply what you learned
Your private practice
Answers are private. Completion requires the correct knowledge-check answer and a written response when an activity is included.
Restore a downloaded workbook
Choose a recovery file for this course and version. Review the recovered copy before saving it to your account.
Ask a question or report a problem
Describe what needs attention. Your private answer is shared only if you select the option below.