World map

 

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 are hereyou@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 boot
  • sshrunningstarts at boot
  • nginxrunningstarts 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 are hereyou@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 boot
  • sshrunningstarts at boot
  • nginxrunningstarts at boot

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 are hereyou@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 boot
      • sshrunningstarts at boot
      • nginxrunningstarts at boot

      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.