Lab 7 - Wildcards & Brace Expansion
WORK IN PROGRESS
- Lab 7 - Wildcards & Brace Expansion
- WORK IN PROGRESS
- A Brief description of the wildcards.
- Video
- Question 1: Complete Practice exercise
- Question 2: Challenge 1
- Question 3: Challenge 2
- What will you submit:
- How I will grade you:
- Special Note 1 - Practice navigating the file system
- Special Note 2 - Git Command Quick Reference
- Special Note Regarding the Final Exam
A Brief description of the wildcards.

Cheat Sheet here
Video
Note: Wildcards are all about pattern matching. They can be confusing but once you get a hold of them, you will never forget them. The table above gives you a summary of each wildcard. The goal of this lab is to give you enough practice for you to master wildcards in their basic form. Wildcards are very powerful because they can be combined to match pretty much any pattern that you can think of.
Question 1: Complete Practice exercise
- Complete the practice exercise in the presentation. Take a screenshot of your terminal after finishing each practice.
Deliverable of Question 1
- Add each screenshot to your
lab7.mdfile - Make sure to label each screenshot properly using heading 3 formatting or just a bold paragraph. Ex:
### Practice 1

Question 2: Challenge 1
Use brace expansion to create the following directories:
Directory 1
wallpapers/
└── cars
├── 1080p
├── 2k
└── 4k
Directory 2
assets/
├── imgs
│ ├── large
│ └── small
└── video
├── large
└── small
Deliverable of Question 2
- Take a screenshot (or more than 1) show each command you use to create the directories
- Use the
treecommand to display a tree of each directory directory. - Place the screenshots in your
lab7.mdfile as you always do in every lab - Once you have finished this question, delete the directories.
Question 3: Challenge 2
Organize a directory using only wildcards and brace expansion. You are not allowed to operate on files individually. Every command you use to organize the files must use a wildcard.
- Run this script to generate the directory that contains all the files you will work with. I recommended making a copy of the directory before you start working on this.
curl https://cis106.com/assets/scripts/chq-lab7.sh | bash - Once you finish organizing the files, the directory must look like the terminal on the right. The terminal on the left shows you the starting point. The terminal on the right shows you the final result. Use the output of the terminal on the right to understand where you must place each file.

Rules of the challenge
- You are not allowed to create directories using the file manager.
- You are not allowed to create directories 1 at a time. You have to use brace expansion
- You are not allowed to move files 1 at a time. You have to use wildcards.
- You are not allowed to use the file manager. You have to complete this challenge using just the terminal
Tips to approach this challenge
- Use more than 1 terminal.
- A terminal window for listing files.
- Another terminal window should be used for creating the necessary directories
- Another terminal window for moving the files to their respective directories
- You should identify the necessary directories and subdirectories that you will need to create before using the Brace Expansion. I suggest you write the brace expansion in a text editor first. Remember: No spaces within the brace!
- Use the image above to figure out what the files have in common to understand which wildcard or combination of wildcards will be best.
- Before you attempt to move the files, try listing them first. That will allow you to test your wildcard before moving. If it works with ls then it will work with mv!
Deliverable of Question 3
- Take a screenshot (or more than 1) show each command you use to organize the directory
- Use the
treecommand to display a tree of the organized directory. - Place the screenshots in your
lab7.mdfile as you always do in every lab - Once you have finished this question, delete the directories.
What will you submit:
- After placing every screenshot in your
lab7.mdfile, convert the file to pdf - Push everything to GitHub
- In Blackboard, submit the pdf file
lab7.pdfand the URL oflab7.mdin GitHub
How I will grade you:
- Question 1: 50 pts
- Question 2: 25 pts
- Question 3: 25 pts
Special Note 1 - Practice navigating the file system
- Focus on the steps you took to answer the challenge questions. You will have 1 question in the final that requires the same workflow.
Special Note 2 - Git Command Quick Reference
You’ll be using Git frequently this semester. Here’s a quick reminder of the most common commands:
| Command | Purpose |
|---|---|
git clone repository/url/here | Download a GitHub repository to your computer. |
git pull | Synchronize your local repository with the latest changes from GitHub. Always run this before starting work in VS Code. |
git add . | Track all changes made to your files. |
git commit -m "description here" | Save a snapshot of your tracked changes with a short description. |
git push | Send your committed changes to GitHub. |
Command Order:
git pull
git add .
git commit -m "message"
git push
⚠️ Warning: ⚠️
Avoid making changes directly in the GitHub website unless you:
- Know exactly what you are doing, and
- Remember to run git pull before working locally.
Special Note Regarding the Final Exam
- The final exam will be in person.
- It is performance-based and requires access to a Linux Virtual Machine.
- If you do not have a laptop/computer you can bring to school:
- A Linux workstation will be available on campus.
- Request it early—available computers are limited.