
Vediamone degli esempi da riga di comando (aprire il terminale per provarli):
1) locate termine da ricercare
Locate trova il file direttamente da un database. Per questo è velocissimo. Il db però va aggiornato: per fare questo è importante prima di lanciarlo eseguire il comando updatedb
2) find directory -name termine_di_ricerca
E' molto piu' lento del precedente.
Esempio:
find / -name prova
trova tutti i file a partire dalla radice che contengono il termine prova
E' possibile utilizzare anche altri parametri come -size e -ctime, che indicano il primo la grandezza del file in K, il secondo i giorni dalla creazione.
find directory -name termine_di_ricerca -size 200
find directory -name termine_di_ricerca -ctime 4
3) grep file pattern
trova tutti i file che contengono una parola o una stringa di testo.
grep ragione *.txt
trova i file *.txt che contengono il termine ragione
Google automatic translation:
Find a file with UBUNTU terminal
On ubuntu (linux) there are several ways to find a file, each to be used in relation to your needs.
Let the examples from the command line (open the terminal to try):
1) locate search term
Locate the file directly from a database. That is why it is very fast. However, the db should be updated to do this is important before you start running the command updatedb
2) find directory-name termine_di_ricerca
E 'molto piu' slow above.
Example:
find /-name test
find all files from the root that contain the word test
E 'can also use other parameters such as size-and-ctime, which indicate the first file size in K, the second day of creation.
find directory-name termine_di_ricerca-size 200
find directory-name termine_di_ricerca-ctime 4
3) grep pattern file
find all files that contain a word or text string.
grep reason *. txt
find *. txt files that contain the term reason

Nessun commento:
Posta un commento