Posts Tagged With: find

Replacing in Found Files

Tagged with: , , , , , ,

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' {} \;
No Comments »

Find Link Files

Tagged with: , , , ,

Use this command to find all the links in the current directory…


find . -lname "*"
No Comments »

Locate Files With Names Matching A Regexp

Tagged with: , , , , , , , , ,

You can use locate to find files with name that matches a said regexp…


locate -i -r '\.jpg$'
No Comments »

Find files of a specific mime-type

Tagged with: , , , , , , ,

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


find -type f -print0 | xargs -0 file -i | grep -i video

And, by the way, this command, and the last two commands were sponsored by Mahesh. Happy now?

1 Comment »

Find Alsa Version

Tagged with: , , , , , ,

Find the version of alsa using this command…


cat /proc/asound/version

Thanks to Sreenath(Hacking With Debian) for this tip.

No Comments »

Optimized Grep Searching

Tagged with: , , , , , , ,

Grep that searches recursively, ignores binary files, and doesn’t look inside Subversion hidden folders.


grep -Ir --exclude="*\.svn*" "pattern" *
No Comments »

Archive all files with a given extension

Tagged with: , , , , ,

Find all files with ‘.log’ extention and make an bzip archive


find /var/log -name '*.log' | tar cv --files-from=- | bzip2 > log.tar.bz2
No Comments »

Remove SVN Info from a Folder

Tagged with: , , , ,

This command removes the SVN data from a folder.


find -name .svn -exec rm -rf {} \;
2 Comments »

Exclude Removable Partitions from a ‘find’ Search

Tagged with: , , , , ,

Search files with ‘.rpm’ extension ignoring removable partitions as cdrom, pen-drive, etc.


find / -xdev -name \*.rpm
No Comments »

Find New Files

Tagged with: , , , , , ,

Search files created or changed within 10 days


find /usr/bin -type f -mtime -10
No Comments »