Tag: find

Replacing in Found Files

Replace one string by another in all file found by find. find . -name *whatyouwant* -exec perl -pi.bak -e ‘s/TEXT_TO_REPLACE/TEXT_TO_REPLACE_IT_WITH/g’…

Find Link Files

Use this command to find all the links in the current directory… find . -lname “*”

Locate Files With Names Matching A Regexp

You can use locate to find files with name that matches a said regexp… locate -i -r ‘\.jpg$’

Find files of a specific mime-type

Use this command to find files of a given mime-type. In this example, we are looking for video files… find…

Find Alsa Version

Find the version of alsa using this command… cat /proc/asound/version Thanks to Sreenath(Hacking With Debian) for this tip.

Optimized Grep Searching

Grep that searches recursively, ignores binary files, and doesn’t look inside Subversion hidden folders. grep -Ir –exclude=”*\.svn*” “pattern” *

Archive all files with a given extension

Find all files with ‘.log’ extention and make an bzip archive find /var/log -name ‘*.log’ | tar cv –files-from=- |…

Remove SVN Info from a Folder

This command removes the SVN data from a folder. find -name .svn -exec rm -rf {} \;

Exclude Removable Partitions from a ‘find’ Search

Search files with ‘.rpm’ extension ignoring removable partitions as cdrom, pen-drive, etc. find / -xdev -name \*.rpm

Find New Files

Search files created or changed within 10 days find /usr/bin -type f -mtime -10