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.

25–35 min Week 1 · Terminal basics Ubuntu terminal
Your outcome: You can create practice files without fear because they live in one disposable folder.
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 folder

Creates 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 folder

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.

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 folder

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

Run from ~/linux-practice

stat myfile.txt

Identify file type

Read-only system view

Compares 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

  1. Create a file called notes.txt.
  2. Create files/inbox with mkdir -p, then remove one empty practice directory with rmdir.
  3. 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.

  1. Which command shows file metadata?
  2. Why is file more reliable than only checking the extension?

Your practice, your pace

Loading saved progress…

Discussion

Continue the conversation about this guide. Loading comments connects to GitHub Discussions through giscus.

Open community discussions on GitHub

Check before you copy

This command needs care. Read its context, confirm the target and location, and keep a recovery path.

Copying does not run a command.