Wildcards in bash - what a joy!

TIL - wildcards can be applied in a powerful way to answer the question "I have the file name or pattern, but don't know the directory, or the subdirectory".

Kalle Tolonen
26.10.2026

Magic

cat ~/.dot/folder/*/file.yaml

<contents of file>

In the case of multiple files in the same subdir:

cat ~/.dot/folder/*/*.yaml

<file 1...n>

<file 2...n>

Does this have any practical implications? Well, as a part of something else, like substituting the cat cmd to cp and then using this as a part of copying only *.pdf files from 1 particular subdirectory to somewhere. Another usecase could be log synthesis, where you would actually tail -f multiple files while they generate input and pipe output to grep for some inspections. Could be useful to track an oid tru a microservices ecosystem.


Comments

No published comments yet.


Add a Comment

Your comment is held for review before it appears publicly.

Tick the box, then click Submit right away (Google expires the check after about two minutes).