Find and delete all core files

Contributor Icon Contributed by qmchenry  
Tag Icon Tagged: UNIX  

Locate and remove all core files in system using the find command.

find / -name core -exec rm {} \;

The find command replaces the {} characters in the command above with the filenames that it finds. You must include the \ immediately before the ; character.

See the comments for a more advanced method of accomplishing this.

 

2 Comments -


  1. Stef said on October 23, 2008

    sparkomemphis on http://ncaabbs.com/showthread.php?tid=229890 has this example that will help prevent removing non-core files named (lets not argue that there should not be any of these) core.

    find . -name core* -user $USER -type f -size +1000000c -exec file {} ; -exec ls -l {} ; -exec printf “nny to remove this core filen” ; -exec /bin/rm -i {} ;

  2. Quinn McHenry said on October 23, 2008

    I like that! Nice bit of code. Thanks for sharing!

 

RSS feed for comments on this post. TrackBack URL

Leave a comment -