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 :))
Related articles by Zemanta {."zemanta-related-title"}
- Suicide Linux @ Things Of Interest (dccrowley.posterous.com)
Related Articles:
- 2010/01/19 Perl script to create csv files with a pattern β Generic script.
- 2010/03/16 prepend to a file with sponge from moreutils
- 2010/03/16 Ubuntu Sucks Like a Shopvac and Other Linux Rants
- 2010/03/13 KDE For Windows β An Overview
- 2010/03/12 Fedora 12 Released
Authored By Amit Agarwal
Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.