Wildcards · Wildcard
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · Halaman ini memerlukan browser terbaru (dengan dukungan SharedArrayBuffer). Silakan perbarui Chrome, Edge, Firefox, atau Safari ke versi terbaru.
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:
Bahasa Indonesia
Satu perintah, banyak file
- Wildcard adalah simbol yang mewakili "apa pun". Yang paling umum adalah
*. *.txtberarti "setiap nama yang berakhiran.txt". Shell akan mengisi kecocokan untuk Anda:
ls *.txt
English
The two main wildcards
*matches any number of characters (even none).?matches exactly one character.
- So
file?.txtmatchesfile1.txtandfileA.txt, but notfile10.txt.
Bahasa Indonesia
Dua wildcard utama
*cocok untuk semua jumlah karakter (bahkan nol).?cocok dengan tepat satu karakter.
ls file?.txt
- Jadi
file?.txtcocok denganfile1.txtdanfileA.txt, tetapi tidak denganfile10.txt.
English
Be careful with delete
- Wildcards are powerful — and that cuts both ways:
- That deletes every
.txtfile at once. Runls *.txtfirst to see exactly what will go.
Bahasa Indonesia
Hati-hati dengan delete
- Wildcard sangat kuat — dan itu berlaku dua arah:
rm *.txt
- Itu akan menghapus semua file
.txtsekaligus. Jalankanls *.txtterlebih dahulu untuk melihat persis apa yang akan hilang.
English
Common mistakes
*matches any text and?matches one character.- Quote a name that has spaces, or the shell splits it into two.
Bahasa Indonesia
Kesalahan umum
*cocok dengan teks apa pun dan?cocok dengan satu karakter.- Kutip nama yang memiliki spasi, atau shell akan memecahnya menjadi dua.
List only the .txt files using the * wildcard: ls *.txt. · Tampilkan hanya file .txt menggunakan wildcard *: ls *.txt.
Delete all the .txt files at once with rm *.txt. The check lists what is left. · Hapus semua file .txt sekaligus dengan rm *.txt. Pengecekan menampilkan apa yang tersisa.