Thuta Learning
ExercisesDevOps & Toolsbeginner

Exercise: File System, Permissions, and Basic Commands Practice

Relax. We'll talk through this in plain words — no textbook voice.

What you'll walk away with

  • Practice File System, Permissions, and Basic Commands hands-on
  • Solidify the skills you've already learned through practice
  • Get comfortable spotting mistakes, fixing them, and checking your own work

Let's think about it this way for a second

This lesson isn't teaching anything new — it's written to give you hands-on practice with the cd/ls/mkdir/touch, cp/mv, chmod/chown, and grep/pipe skills you learned in the Basic and Intermediate chapters. Typing it into the terminal yourself and actually doing it is what builds muscle memory, so work through these tasks one by one instead of skipping ahead. Each task builds on the one before it, so it's best to do them in order. The difficulty ranges from easy to medium — a good fit if you're relatively new to the Linux command line.

Practice exercises

Task 1: Create a directory called practice-lab under $HOME, and create two subdirectories, docs and backup, underneath it with a single mkdir -p command; then use touch to create two files, notes.txt and todo.txt, inside docs. Task 2: open notes.txt with nano/vim and write three or four lines (make sure the word Linux appears), then check the permissions with ls -l and use chmod to give write access only to the owner, keeping group/others read-only (644 → owner rw, group/others r). Task 3: use grep -i "linux" docs/notes.txt | wc -l with a pipe to count how many times the keyword appears. Task 4: copy the entire docs directory into backup with cp -r, and move just todo.txt into backup with mv — then compare the results in ls on both sides to see how they differ.

Code example

bash
# Task 1: nested folder + files
mkdir -p ~/practice-lab/{docs,backup}
touch ~/practice-lab/docs/notes.txt ~/practice-lab/docs/todo.txt

# Task 2: permission check + change
ls -l ~/practice-lab/docs/notes.txt
chmod 644 ~/practice-lab/docs/notes.txt   # owner rw, group/others r

# Task 3: grep + pipe + count
grep -i "linux" ~/practice-lab/docs/notes.txt | wc -l

# Task 4: copy vs move
cp -r ~/practice-lab/docs ~/practice-lab/backup/
mv ~/practice-lab/docs/todo.txt ~/practice-lab/backup/
ls -R ~/practice-lab
You should see
The docs/backup structure is fully set up under practice-lab, notes.txt has permissions -rw-r--r--, and the grep count command reports the number of matching lines as a number.

5-minute try-it

Within 5 minutes, find the files under the backup directory with find ~/practice-lab/backup -type f -name "*.txt", and count the resulting file list with wc -l.

One thing to watch out for

Don't touch real files in your home directory while practicing — carve out a fresh, throwaway folder like practice-lab before trying out chmod/rm commands.

Easy traps

  • Writing brace expansion without a space, like mkdir -p{docs,backup}, and hitting an error — it needs a space, like mkdir -p {docs,backup}
  • Wanting to change permissions recursively across a whole directory with chmod but forgetting the -R flag, so the subfolders' permissions are left unchanged

Now try it yourself

Within 5 minutes, find the files under the backup directory with find ~/practice-lab/backup -type f -name "*.txt", and count the resulting file list with wc -l.

You'll know it worked when: The docs/backup structure is fully set up under practice-lab, notes.txt has permissions -rw-r--r--, and the grep count command reports the number of matching lines as a number.

Exercise: File System, Permissions, and Basic Commands Practice | Thuta Learning