Find files and listing details on Linux

One common task that we always have to do relatively often is to find the location of some specific files. Although you may have some clues that those files are located in your current working directory, “.” symbolic link used in the command below, you may have no clue to which sub-folder your files are.

You can use find to locate your files. For example, the command below -iname look for a pattern ignoring the case.

find . -iname "vcf"

However, you may want to know more info about the file size & permission. In this case, you can execute a command on each file using -exec option, which operate on each element of the result stored in {}. \; at the end of the command is each file will be executed individually, while + will include as many files found as possible at once.

find . -iname "vcf" -exec ls -l {} \;
find . -iname "vcf" -exec ls -l {} + # this may be a bit faster for ls

The results from ls although look the same for both endings, might look different from grep which will also show the pattern list being search for if you use the \; ending.


Author: hypotheses

A medical doctor with a passion in maths, genetics, and information technology. A Doctor of Philosophy in Genetic Epidemiology who doesn't stop with just statistical satisfaction.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.