Wildcards
หน้านี้ต้องใช้เบราว์เซอร์ล่าสุด (รองรับ SharedArrayBuffer) กรุณาอัปเดต Chrome, Edge, Firefox หรือ Safari เป็นเวอร์ชันล่าสุด
English
One command, many files
- A wildcard is a symbol that stands for "anything". The most common is
*. *.txtmeans "every name ending in.txt". The shell fills in the matches for you:
ls *.txt

English
The two main wildcards
*matches any number of characters (even none).?matches exactly one character.
ls file?.txt
- So
file?.txtmatchesfile1.txtandfileA.txt, but notfile10.txt.
English
Be careful with delete
- Wildcards are powerful — and that cuts both ways:
rm *.txt
- That deletes every
.txtfile at once. Runls *.txtfirst to see exactly what will go.
English
Common mistakes
*matches any text and?matches one character.- Quote a name that has spaces, or the shell splits it into two.
ความยาก 2/5 · 140 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
List only the .txt files using the * wildcard: ls *.txt.
ความยาก 2/5 · 140 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
ลบ ทั้งหมด the .txt files at once with rm *.txt. The check lists what is left.
ความยาก 2/5 · 140 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
This folder holds file1.txt, fileA.txt และ file10.txt. List only file1.txt และ fileA.txt with หนึ่ง ls and a wildcard, so that file10.txt is left out.