PDF Version Available
This document is also available in PDF format: cmdsandwildcards.pdf
The PDF version includes bookmarks for easy navigation and is optimized for printing.
Accessibility Notice
This document is also available in HTML format at:
Link: https://aholdengouveia.name/IntroLinux/labs/cmdsandwildcards.html
The HTML version provides enhanced accessibility features including keyboard navigation, screen reader support, responsive design, dark mode support, and high contrast options.
Learning Outcomes
By the end of this lab, you will be able to:
- Use wildcards with ls to list files that match a pattern, including hidden files
- Use find to locate files
- Explain the difference between ls and find for locating files
Lab Instructions
How to set up for this lab
We are going to create a test directory with files, and then use wildcards and find to locate them.
- Create a test subdirectory for this lab. I do NOT recommend using any spaces in the names of files or folders.
- Using touch, create at least a dozen files. Look at the problems below, and make sure you have files that match each requested pattern and files that don't, so you can see your wildcards working. Include at least one hidden file (a file name that starts with a .).
- If you're struggling to think of names, use a naming scheme such as characters from your favorite video game, or locations and characters from favorite books etc. Make sure your files are full names of at least 5 characters, not just single letters/numbers.
- For each of the problems you should start with ls and then figure out the pattern needed to show the requested information, then pick 1 of them to try with find instead.
- A demo of how to use ls is in my FAQ Linux playlist, linked under Resources.
Problems to solve
Use wildcards and the ls command to answer the following.
- All files
- All files including hidden files.
- Files that start with “f”
- Files that start with “f” or “F”
- Files that have “f” or “F” anywhere in the name
- Files that have a digit in the name
- Files that start with a through d
- Files that end with 1 or 2
- Experiment with the find command by solving one of the above questions using find instead of ls.
Deliverables
One file that has the lab title, name and date and the answers.
- Each problem given should be numbered to match the question
- Make sure to list each command and the result.
- Make sure to take a screenshot of each successful command.
- Don't use one screenshot for everything, make sure each screenshot is labeled with which problem it solved. Your screenshots must show your prompt with your username, or a note with your name and the term.
Resources
References, a video, a PowerPoint and some notes are available at my website Link: https://www.aholdengouveia.name/IntroLinux/cmdsandwildcards.html
My FAQ Linux playlist on YouTube, with demos of many of the commands and scripts in this class Link: https://www.youtube.com/playlist?list=PLQOmuLC45eoQlIMH7oCNL6yFP7kWQubBo