Wildcards on Linux: A Practical Guide
Leveraging the power of this small feature
Published in
3 min readMay 4, 2022
The usage of wildcards on Linux is a good example of how leveraging a small feature skillfully can make our lives easier.
For instance, if we have downloaded a large video file that was split into lots of small chunks. What is the easiest way to merge them back into one single video? 🤔
If the files were named as follows:
- ironman.mpeg.001
- ironman.mpeg.002
- …
- ironman.mpeg.099
We could merge them through one line of command:
cat ironman.mpeg.0* > ironman.mpeg
Too good to be true? 🙂
In detail, there are 3 points you need to know about the above trick:
- The
cat
command (stands for concatenate) is used to combine multiple files. - The
*
is a wildcard which can match any characters. And it will keep the original order of the matched files, so we don’t need to worry that the video will be messy. - The
>
is a trick to redirect the standard output into a file.
So far so good. Isn’t it?