Line At A Time
Level 16: Wildcards
Wildcards Talk about a whole group of files at once.

The * is a wildcard meaning "any characters at all". The shell swaps *.txt for every matching name BEFORE the command even runs, so ls never sees a star: it sees pets.txt shopping.txt.

That is worth knowing, because it means wildcards work with every command, not just ls. cp *.txt backup/ copies them all; rm *.txt deletes them all, which is exactly as dangerous as it sounds.

The star can go anywhere in a name. s* means "every name starting with s"; *e* means "every name with an e in it somewhere".

ls *.txtEvery name ending .txt
ls s*Every name starting with s
ls notes/*Everything inside notes
Your task
  • List only the .txt files
  • List everything starting with s

Open this level in your browser to type the commands at a live terminal that answers back.