Recap - Selective Operations
Part of the Fundamentals section of Coddy's Terminal journey — lesson 29 of 82.
Challenge
EasyPut all your wildcard skills together!
- Create a new directory called
archiveusingmkdir - Move only the single-digit
.jpgphoto files intoarchive/using the[0-9]bracket wildcard - Move all
report_?.txtfiles intoarchive/using the?wildcard - Delete all remaining
.pngfiles using the*wildcard - List the home directory with
lsto confirm what remains - List the archive folder with
ls archiveto confirm its contents
Note:
photo_10.jpgshould stay in the home directory — it has two digits so it won't be matched by[0-9]. Think carefully about which wildcard to use for each step!
⚠ Clean up first: If you see unexpected directories (like
family,nature, ortravel) in your home directory — possibly left over from a previous lesson — remove them before running the steps above. Userm -rf <dirname>for each one (for example,rm -rf family). This ensures yourlsoutput matches the expected result.
Try it yourself
All lessons in Fundamentals
4Directories
Create A DirectoryCopy A DirectoryMove And Rename A DirectoryDelete A DirectoryRecap - Directory Operations7File Content
Head And TailWord CountSort CommandUnique CommandGrep BasicsGrep With FlagsRecap - Text Detective2Navigation
Print Working DirectoryList FilesChange DirectoryAbsolute vs Relative PathsHome And Root DirectoryRecap - Find Your Way8Redirection
Standard OutputOverwrite To A FileAppend To A FileStandard InputStandard ErrorRecap - Log Builder6Wildcards And Patterns
The Star WildcardThe Question Mark WildcardBracket WildcardsCombining WildcardsRecap - Selective Operations9Piping
What Is A PipeChaining Two CommandsChaining Multiple CommandsPipe With GrepRecap - Data Pipeline