Mission 3 of 30
Creating and Inspecting Files
Create a predictable project structure and inspect what Linux recorded.
Create empty files, inspect timestamps, and ask Linux what type a file really is.
Practice inside
~/linux-practice. Check your setup before you begin.
Prerequisite: Changing Directories and Understanding Paths
.
What you’ll practice
- Create files with touch
- Inspect metadata with stat
- Identify file types
The mental model
- File extensions are helpful hints, but Linux can inspect real content.
- Timestamps include access, modification, and metadata change times.
Try it in your terminal
Create files
Safe in practice folderCreates empty files and demonstrates brace expansion.
Run from ~/linux-practice
cd ~/linux-practice
touch myfile.txt
touch file_{1..5}.txt
ls -l Create and remove empty directories safely
Safe in practice foldermkdir -p creates missing parent folders without failing when they already exist. rmdir removes only an empty directory, making it a safer first removal command than rm -r.
Run from ~/linux-practice
cd ~/linux-practice
mkdir -p files/{inbox,archive}
ls -ld files files/inbox files/archive
rmdir files/archive Inspect file metadata
Safe in practice folderShows size, permissions, owner, timestamps, and inode.
Run from ~/linux-practice
stat myfile.txt Identify file type
Read-only system viewCompares a text file with a real executable.
Run from ~/linux-practice
echo 'Hello Ubuntu' > myfile.txt
file myfile.txt
file /bin/bash Put it into practice
- Create a file called notes.txt.
- Create files/inbox with mkdir -p, then remove one empty practice directory with rmdir.
- Use stat and file on notes.txt.
Check your result
The expected files and directories appear in a long listing.
Common mistakes
- You run `touch notes.txt` and expect to see text inside when you open it. You won't. `touch` creates an empty file or updates a timestamp. That's it. To add content, use `echo` or an editor.
Check your understanding
Explain these in your own words. If you’re unsure, revisit the examples before moving on.
- Which command shows file metadata?
- Why is file more reliable than only checking the extension?
Your practice, your pace
Loading saved progress…