CodingNic

Terminal Fundamentals

Terminal Basics Exercises

Terminal Fundamentals 20 min read

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:

  1. Make a directory called first.
  2. Change directory into first.
  3. Create a file called person.txt.
  4. Rename person.txt to another.txt.
  5. Copy another.txt to copy.txt.
  6. Remove copy.txt.
  7. Copy the first folder to second.
  8. Delete the second folder.

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

  1. What does man do? Run man rm โ€” how do you scroll, and how do you get out?
  2. Open the man page for ls. What do -l and -a do?
  3. Run curl https://www.google.com > google.html to download and save the page.
  4. Open google.html with less.
  5. In less’s man page, read the section on /pattern. Search google.html for the text hplogo.
  6. Using the shortcuts above, how do you jump between words in Terminal?
  7. How do you get to the end of a line?
  8. How do you move your cursor to the beginning of a line?
  9. How do you delete a whole word at once, without pressing backspace repeatedly?
  10. What’s the difference between a terminal and a shell?
  11. What’s an absolute path?
  12. What’s a relative path?
  13. What’s a flag? Give three examples you’ve used so far.
  14. What do the r and f flags do for rm?

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.

  1. Mini project setup. Create a folder called recipes, move into it, then create pasta.txt and soup.txt. Use echo and a redirect to write serves 4 into pasta.txt, then confirm it with cat.
  2. Backup. Copy the entire recipes folder to recipes_backup. Remove pasta.txt from the backup only โ€” the original recipes/pasta.txt should be untouched. Confirm with ls in both folders.
  3. Hidden file hunt. Run ls -a in your home directory and name three hidden files or folders you find there.
  4. Nested folders in one shot. Open man mkdir and find the flag that creates missing parent folders automatically instead of erroring out. Use it to create projects/2026/july with a single mkdir command.
  5. 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 to echo "fast fingers" and run it.
  6. Clean sweep. Remove everything you created in this section: recipes, recipes_backup, and projects.

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.