//View Tip #680
Similar Tips
» Delete old files
» Find files by modified time
» Deleting difficult filenames
» Add a line to files using find and echo
» Replace expr by other recursively


Latest tips by RSS
Click here to subscribe
Follow Shell-Fu on Twitter
Click here to follow
Follow Shell-Fu on identi.ca
Click here to follow
Use this to find core files and remove them:

find . | egrep "\/core\.[0-9]+$" | xargs rm -f

This works well as it finds only core files.

View Comments »


Add your comment

Comments are currently disabled
wow, that's needlessly complicated and inefficient.  This is better:

find . -name "core.*" | xargs rm -f
Posted 2009-04-17 13:02:12
How about that?
find . -type f -regex '.*/core\.?[0-9]*$' -ls -exec rm -f {} \;
Posted 2009-04-17 13:02:37

find . -type f -regex '.*/core\.?[0-9]*$' -delete
Posted 2009-04-17 14:13:10
You may want to try it without the rm first or use rm -i because there could be files that match the description that are not core dump files. It finds a lot of SVN files when I just have it print results.
Posted 2009-04-19 20:55:11

Home Latest Browse Top 25 Random Hall Of Fame Contact Submit