AI Hints
Home›Linux Tutorial›Links and Disk Space
Linux · Lesson 42 of 120

Practice: Files Challenge

Putting it all together.

⏱ 2 min read▶ Video at 53:49🎓 Free
Watch this lesson in the Linux courseWatch on YouTube ↗Full Linux course

You now know a lot about files and folders. Let's put it together in one challenge. Read the task, pause, and try it in your own terminal.

Practice: Files Challenge
From the video: Practice: Files Challenge
  • You know a lot now
  • One challenge
  • Pause and try it

The challenge

Make a folder called archive. Copy every text file from your home folder into it. Rename the to do file inside archive to old todo dot TXT. Then show the result with LS dash L. Pause now.

1mkdir archive
2copy every .txt from home
3rename todo.txt inside it
4check with ls -l

A solution

Here's one way. MK dir archive. Then CP star dot TXT archive, copies both text files at once. MV renames the to do file inside the archive. And LS dash L archive shows both files, with the new name. Did yours match?

Terminal
mkdir archive
cp *.txt archive
mv archive/todo.txt archive/old-todo.txt
ls -l archive
total 8
-rw-r--r-- 1 sam sam 30 Jan  5 09:00 notes.txt
-rw-r--r-- 1 sam sam 58 Jan  5 09:00 old-todo.txt

What you used

In that one task, you used four commands, a wildcard, and both kinds of path. That's the core of working with files on Linux. Everything else builds on this.

keyvalue
mkdirmade a folder
cp + *.txtcopied with a wildcard
mvrenamed
ls -lchecked the result

Summary

You can create, copy, rename, find, and inspect files from the terminal. Next, a new section. Searching inside files, with grep.

Key takeaways
  • mkdir, cp, mv
  • Wildcards
  • ls -l to check
Next up: grep: Searching Inside Files — find lines that match