Linux tip: How To Find and Execute Linux Commands and Files

By Detector | 24 March 2009



This is simple Linux tip for using find command. The find command in Linux is not only useful for finding files, but is also useful for processing the ones it finds too. Here is a quick example:

Suppose we have a lot of tarballs, and we want to find them all:

find . -name ‘*.gz’

will locate all the gzip archives in the current path. But suppose we want to check they are valid archives?

The gunzip -vt option will do this for us, but we can cunningly combine both operations, using xargs:

find . -name ‘*.gz’ | xargs gunzip -vt

Tags | , ,

| |

Comments are closed.





Archives

Add to Technorati Favorites
website stats
TwitterCounter for @ukion