While it's a simple task to copy 1 file somewhere else, what if we have a LOT of files to copy?
Wildcards are special characters we can use to signify a collection of files with similar names.
• a collection of tunes (.mp3 or .flac)Regardless of what the files are named, if they ALL have something in common in their name, we can use a wildcard to refer to them - list, copy, delete or move them.
Think of a wildcard like the Joker in a deck of cards - it can stand for any other card, like a variable in algebra.
Wildcards can be used with several commands, whenever we are dealing with files:
So, what ARE these 'special' characters?
The most popular is the asterisk or 'star': *
It stands for, well, everything. Recall we are referring to file names, and filenames typically look like 'filename.ext'.
ext is short for extension and usually indicates what kind of file it is.
So when we want to deal with a collecton of image files (.jpg) we can refer to them as *.jpg
The * in this case refers to ANY name BUT the .jpg refers ONLY to files ending with .jpg
If you want to see a list of all the .pdf files in a directory, you could type ls *.pdf:
2024-11-23 12:49:05 [/Volumes/femto/FemtoDocuments/Mathematics] trudge: ls *.pdf ABC Equation.pdf Calculator Precision.pdf Calculus 11E - Larson & Edwards 2018.pdf Calculus Better Explained - Kalid Azad.pdf Calculus.pdf Circle Formulae.pdf Conics Formulae.pdf Divisibility.pdf Drilling square holes — Mathematical Etudes.pdf Elementary Algebra.pdf Ellipse - Wikipedia.pdf Ellipse.pdf Formula and graph of a hyperbola.pdf Fundamentals of Mathematics - Functions and Graphs.pdf Hyperbola 1.pdf Hyperbola 2.pdf Hyperbola 3.pdf Hyperbola equation examples.pdf Hyperbola.pdf LaTex.pdf Manga Guide To Calculus (The).pdf Math Handbook.pdf Math Wonders to Inspire Teachers and Students.pdf Maths - Trigonometry - Martin Baker.pdf My Calculus.pdf Project Origami Activities for Exploring Mathematics.pdf Pythagorean Triples.pdf Reciprocal.pdf Reuleaux triangle - Wikipedia.pdf Rounding.pdf Rule of Three -- Wolfram MathWorld.pdf Rule of Three.pdf The Hyperbola.pdf The Quest to Decode the Mandelbrot Set, Math’s Famed Fractal | Quanta Magazine.pdf Trigonometry Formulae.pdf Trigonometry.pdf
This required me to cd to that directory (/Volumes/femto/FemtoDocuments/Mathematics) first, but we could have achieved a similar result this way:
ls /Volumes/femto/FemtoDocuments/Mathematics/*.pdf
Since the asterisk stands for ANY character/s, we could get a list of PDF files that begin with 'Hyperbola':
ls Hyperbola*.pdf Hyperbola 1.pdf Hyperbola 3.pdf Hyperbola.pdf Hyperbola 2.pdf Hyperbola equation examples.pdf
As another example, you could also enter rm *.pdf, which would remove (delete) ALL PDF files in the directory.
Oddly, it's not rm, or any command that expands the *. It's the shell that does it.
Access Control List