Contents

Linux find command – Find file and directories faster and easier

2010-03-16 164 words 1 min read

Β 

This command is very powerfull when used with combination of filters and pipes and RE.

I will give some example:

find . -type f –» List all files
find . -type f -exec rm {} <a class=“zem_slink” title=“Path (computing)” href=“http://en.wikipedia.org/wiki/Path_%28computing%29" rel=“wikipedia”>\; –» Delete all files
find . -type d -exec rm {} \; –» Will through some common errors πŸ™‚
find . -name "name"Β  –> find files containing name in the filename
find . -atime 12 –> Find files accessed 12 days ago

Similarly there is ctime for file status change

find . -type d -depth 2 –> find all the directories in the depth 2 of the tree.
find . -tyde d -ok rm -rf {} \; –> Delete all the directories but only after user confirmation

There could be numerous such examples so I will leave it to you do digg the man page for find and then experiment :))

\"Reblog
Enhanced by Zemanta

author

Authored By Amit Agarwal

Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.

We notice you're using an adblocker. If you like our webite please keep us running by whitelisting this site in your ad blocker. We’re serving quality, related ads only. Thank you!

I've whitelisted your website.

Not now
This website uses cookies to ensure you get the best experience on our website. Learn more Got it