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 {} \\\; -->> 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
- Suicide Linux @ Things Of Interest (dccrowley.posterous.com)
One thought on “Linux find command – Find file and directories faster and easier”
You must log in to post a comment.