Search this site

Thursday, March 15, 2012

Search/find files from terminal in Linux ?

 ·   To search allmyfav.mp3file in '/home' directory: 
  sudo find /home -name 'myfav.mp3'

·  To search all MP3 files in '/home' directory: 
 sudo find /home -name '*.mp3'

·  To do case-sensitive search use-iname option 
 sudo find /home -iname '*.mp3'

Searching Files by Size (-sizeoption)

·   Search  all.avifiles of size greater than 200 Mega Byte: 
sudo find /home -name '*.avi' -size +200M
·  Search  all.avifiles of size lesser than 200 Mega Byte: 
sudo find /home -name '*.avi' -size -200M
Searching Files by access time (-atimeoption)
·         Search  all.avifiles how all files that have not been accessed in the/homedirectory for 10 days or more:
sudo find /home -name '*.avi' -atime +30

Searching multiple Files (-ooption:ORoperation)
· To search myfav1.mp3 OR myfav2.mp3 in/homedirectory: 
   sudo find /home -name 'myfav.mp3' -o -name 'myfav.mp3'

No comments:

Post a Comment