Wildcards · Coringas
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · Esta página precisa de um navegador recente (com suporte a SharedArrayBuffer). Por favor, atualize Chrome, Edge, Firefox ou Safari para a versão mais recente.
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:
Português
Um comando, muitos arquivos
- Um coringa (wildcard) é um símbolo que significa "qualquer coisa". O mais comum é
*. *.txtsignifica "todo nome que termina em.txt". O shell preenche as correspondências para você:
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.
Português
Os dois principais coringas
*corresponde a qualquer número de caracteres (mesmo nenhum).?corresponde a exatamente um caractere.
ls file?.txt
- Então
file?.txtcorresponde afile1.txtefileA.txt, mas não afile10.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.
Português
Tenha cuidado ao excluir
- Coringas são poderosos — e isso corta nas duas pontas:
rm *.txt
- Isso apaga todos os arquivos
.txtde uma vez. Executels *.txtprimeiro para ver exatamente o que será removido.
English
Common mistakes
*matches any text and?matches one character.- Quote a name that has spaces, or the shell splits it into two.
Português
Erros comuns
*corresponde a qualquer texto e?corresponde a um caractere.- Aspas em um nome com espaços, ou o shell o divide em dois.
List only the .txt files using the * wildcard: ls *.txt. · Liste apenas os arquivos .txt usando o coringa *: ls *.txt.
Delete · Excluir all · todos the .txt files at once with rm *.txt. The check lists what is left. · Apague todos os arquivos .txt de uma vez com rm *.txt. A verificação lista o que sobrou.