Pages

Google Ads

Wednesday, December 24, 2008

Using the FIND Command (Linux)

You can save time using the find command.

If you want to find a .pdf file on you computer try:

$ find / -name "*.pdf"

Change .pdf for .gif, .jpg, .mp3, etc and search any type of file

Find files with the word mysql

$ find . -name "*mysql*" -type f

Find in every type of file the words "Professor Coruja" inside the folder /home/coruja

find /home/coruja/ -name "*" | xargs grep "Professor Coruja"

Sintaxe
find /directory -name "*" | xargs grep "word"

If you change "*" for the type of file it will works in a different way.

It will search for a PDF file with the name test or with the word test in the name

find /home/coruja/ -name ".pdf" | xargs grep "Test"

It will search in the current directory files .sh with the word text in the name

find . -name "*.sh" | xargs grep "text"

It will in the whole computer files .sh with the word text in the name

find / -name ".sh" | xargs grep "text"

It will in the whole computer files with the word text in the name

find / -name "*" | xargs grep "text"

Find files with the extension .mp3 or .wav

$ find /media/Elements/MP3/ -name "*.mp3" -or -name "*.wav"

Have Fun!!!

No comments: