As the doctor gone rogue

October 15, 2016

Find files and listing details on Linux

Filed under: bash, miscellaneous, ubuntu — Tags: , , , , , — hypotheses @ 12:01 pm

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.
 

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: