I'm trying to delete the core file generated from when my program suddenly crashes.
For that i use this piece of code:
find . -name 'core' -delete
My question is: Is this a correct way of doing it ? Is there a better and more efficient way?
Indeed, it is hard (if not impossible at all) to come up with a "perfect solution" since the names are core files are customizable.
In linux, /proc/sys/kernel/core_pattern determines the name of core files. Therefore, you should check that to decide the pattern to be used in your "find" command.
If you indeed want to delete those core file, you can use:
Note: [including semicolon]