BM: Baca dalam Bahasa Melayu
World L1: The Shophouse
Wildcards and tab completion
You will learn: to match many files with one pattern, and let Tab finish names for you.
Checked with Linux (Debian 13) on 1 Nov 2026
The problem
The inbox has 3 food photos today. Next week it will have 300. They all belong in a photos room. Will you type 300 names?
Pick one answer.
Watch
You are you in /home/you/kedai/inbox. 7 things here. Services: cron running, ssh running, nginx running.
you@kedai:~/kedai/inbox$Folder ~/kedai/inbox
- menu1.txt (file)
-rw-r--r-- - menu10.txt (file)
-rw-r--r-- - menu2.txt (file)
-rw-r--r-- - nasi.jpg (file)
-rw-r--r-- - notes.md (file)
-rw-r--r-- - roti.jpg (file)
-rw-r--r-- - teh.jpg (file)
-rw-r--r--
+ 1 hidden (ls -a)
Services
cronrunningstarts at bootsshrunningstarts at bootnginxrunningstarts at boot
* is a wildcard (* ?): A pattern the shell swaps for matching names: * is any letters, ? is one letter.: it matches any letters. The shell swaps *.jpg for every matching name before the command runs. echo shows the swap.
Predict
? matches exactly one character. What does echo menu?.txt print?
Pick one answer.
Try it
Make a photos room. Then move every photo in with one pattern: mv *.jpg photos/.
You are you in /home/you/kedai/inbox. 7 things here. Services: cron running, ssh running, nginx running.
you@kedai:~/kedai/inbox$Folder ~/kedai/inbox
- menu1.txt (file)
-rw-r--r-- - menu10.txt (file)
-rw-r--r-- - menu2.txt (file)
-rw-r--r-- - nasi.jpg (file)
-rw-r--r-- - notes.md (file)
-rw-r--r-- - roti.jpg (file)
-rw-r--r-- - teh.jpg (file)
-rw-r--r--
+ 1 hidden (ls -a)
Services
cronrunningstarts at bootsshrunningstarts at bootnginxrunningstarts at boot
Hint
Check first withls *.jpg. Same pattern, no risk.Check
Does *.jpg match the name? Sort them.
Drag a card into a box. Or tap the card, then tap the box.
Try it
Tab completion saves typing. Type cat no, then press Tab. The shell finishes the name. Press Enter.
You are you in /home/you/kedai/inbox. 7 things here. Services: cron running, ssh running, nginx running.
you@kedai:~/kedai/inbox$Folder ~/kedai/inbox
- menu1.txt (file)
-rw-r--r-- - menu10.txt (file)
-rw-r--r-- - menu2.txt (file)
-rw-r--r-- - nasi.jpg (file)
-rw-r--r-- - notes.md (file)
-rw-r--r-- - roti.jpg (file)
-rw-r--r-- - teh.jpg (file)
-rw-r--r--
+ 1 hidden (ls -a)
Services
cronrunningstarts at bootsshrunningstarts at bootnginxrunningstarts at boot
Hint
On phones, Tab is in the key row under the terminal.You did it!
You can now match many files at once, and let Tab type.
Go deeper (optional)
Quotes stop the swap: echo "*.jpg" prints the star itself. With no match, ls *.png says No such file or directory.
Real rep (optional): on Linux, type cat /etc/os- and press Tab.
Where the story breaks: a real shophouse has walls. Here a room is just a name in a list. Moving a room only renames it.
Bahasa Melayu
Peti masuk ada 3 gambar makanan hari ini. Minggu depan ada 300. Semuanya patut masuk bilik photos. Mahu taip 300 nama?
* ialah wildcard (kad liar): ia padankan apa saja huruf. Shell tukar *.jpg kepada setiap nama yang padan sebelum arahan berjalan. echo tunjuk pertukaran itu.
? padankan tepat satu aksara. Apa yang echo menu?.txt cetak?
Buat bilik photos. Kemudian alih setiap gambar ke dalamnya dengan satu corak: mv *.jpg photos/.
ls *.jpg. Corak sama, tiada risiko.Adakah *.jpg padan dengan nama ini? Asingkan.
Tab completion (lengkap automatik) jimat menaip. Taip cat no, kemudian tekan Tab. Shell habiskan nama itu. Tekan Enter.
Kini anda boleh padankan banyak fail sekali gus, dan biar Tab menaip.
You finished this before. Practice is always welcome!
Official docs: Bash manual: Filename Expansion · Bash manual: Pattern Matching · Bash manual: Commands for completion
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?