Terminal Basics Exercises
Objectives
This chapter introduces no new commands โ it’s a chance to put Module 1 together: navigating, creating and managing files, using flags, and reading a manual page.
๐ก Note: A couple of the questions below (jumping between words, deleting a word at a time) cover keyboard shortcuts that weren’t taught directly in the earlier lessons โ the short primer below covers them before you hit those questions.
Part I โ Hands-On
Work through these in your own terminal, in order:
- Make a directory called
first. - Change directory into
first. - Create a file called
person.txt. - Rename
person.txttoanother.txt. - Copy
another.txttocopy.txt. - Remove
copy.txt. - Copy the
firstfolder tosecond. - Delete the
secondfolder.
A Few Keyboard Shortcuts
Retyping a long command because of one typo gets old fast. These work in most shells:
| Shortcut | Does |
|---|---|
Ctrl + A |
Jump to the start of the line |
Ctrl + E |
Jump to the end of the line |
Option + โ / โ (or Ctrl + โ / โ) |
Jump one word at a time |
Ctrl + W |
Delete the word before the cursor |
Ctrl + U |
Clear the whole line |
Ctrl + C |
Cancel whatever you’re typing or running |
Part II โ Check Your Understanding
- What does
mando? Runman rmโ how do you scroll, and how do you get out? - Open the man page for
ls. What do-land-ado? - Run
curl https://www.google.com > google.htmlto download and save the page. - Open
google.htmlwithless. - In
less’s man page, read the section on/pattern. Searchgoogle.htmlfor the texthplogo. - Using the shortcuts above, how do you jump between words in Terminal?
- How do you get to the end of a line?
- How do you move your cursor to the beginning of a line?
- How do you delete a whole word at once, without pressing backspace repeatedly?
- What’s the difference between a terminal and a shell?
- What’s an absolute path?
- What’s a relative path?
- What’s a flag? Give three examples you’ve used so far.
- What do the
randfflags do forrm?
Part III โ Challenges
These push past what was taught directly โ a couple require reading a man page to figure out a new flag yourself, the way you actually will on the job.
- Mini project setup. Create a folder called
recipes, move into it, then createpasta.txtandsoup.txt. Useechoand a redirect to writeserves 4intopasta.txt, then confirm it withcat. - Backup. Copy the entire
recipesfolder torecipes_backup. Removepasta.txtfrom the backup only โ the originalrecipes/pasta.txtshould be untouched. Confirm withlsin both folders. - Hidden file hunt. Run
ls -ain your home directory and name three hidden files or folders you find there. - Nested folders in one shot. Open
man mkdirand find the flag that creates missing parent folders automatically instead of erroring out. Use it to createprojects/2026/julywith a singlemkdircommand. - Speed round. Type
ecno "fast fingers"on purpose โ don’t press enter. Using only the keyboard shortcuts from the table above (not the arrow keys one character at a time), fix it toecho "fast fingers"and run it. - Clean sweep. Remove everything you created in this section:
recipes,recipes_backup, andprojects.
Recap
You can now navigate the filesystem, create and manage files and folders, read flags and man pages, edit a command line efficiently, and pull all of that together to solve a small problem end to end. That’s the full toolkit Module 1 set out to teach.
Next module: permissions, redirection, and piping โ where you start controlling who can do what to a file, and chaining commands together.