Suggested day 320–30 minutesSafe in practice folder

Mission 3 of 5

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.

Outcome: You can create practice files without fear because they live in one disposable folder.

Mental model

Understand what is happening

File extensions are helpful hints, but Linux can inspect real content.

Timestamps include access, modification, and metadata change times.

Guided lab

Work through the mission

1

Create files

Safe

Creates empty files and demonstrates brace expansion.

Terminal
cd ~/linux-practice
touch myfile.txt
touch file_{1..5}.txt
ls -l
2

Create and remove empty directories safely

Safe

mkdir -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.

Terminal
cd ~/linux-practice
mkdir -p files/{inbox,archive}
ls -ld files files/inbox files/archive
rmdir files/archive
3

Inspect file metadata

Safe

Shows size, permissions, owner, timestamps, and inode.

Terminal
stat myfile.txt
4

Identify file type

Read-only

Compares a text file with a real executable.

Terminal
echo 'Hello Ubuntu' > myfile.txt
file myfile.txt
file /bin/bash

Checkpoint

Verify the mission

The expected files and directories appear in a long listing.

Try it yourself

One step without a recipe

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.

Need a hint?

When someone tells you 'it's a text file,' run `file` on it anyway. Extensions lie all the time. A file called report.pdf could be an image renamed badly. The `file` command reads the actual bytes and tells you the truth.

Explain it back

Before you move on

  • Which command shows file metadata?
  • Why is file more reliable than only checking the extension?

Shortcuts:Alt + ← previous lessonAlt + → next lessonAlt + H home? focus search