Quote:
find . -name core | xargs file | grep "core file" | sed -e ’s/^.*from\ //’ -e s/\’//g
The above command also gives the signal which triggered the core dump.
Examples from my unix system:
Quote:
rm - received SIGQUIT
sh - received SIGSEGV
stty - received SIGQUIT
Try it on your course sample core files and see what output you get.
I guess that the "sed" can be adjusted to just give the name of the program which caused the core dump. Then it is a case of finding out if the command is in your current path (possibly with the "whence" command but it depends on what Shell you are using).
Be careful. There is a trick in these instructions. If you only use the supplied command you will never find out the name of the core file and therefore not be able to delete the file. Be careful that you don't end up deleting the program which caused the core dump rather than the core dump itself.
Hint: Try the supplied command without the "sed", then consider how to extract the core file name and the name of the command which caused the core dump.
More hint: When you try with filenames like "core*" in the root partition make sure that your "find" includes "-type f" and that you correctly identify a file as a core dump. Many systems include a directory called "core" and most have "man" pages related to "core" - all of which are files which you definitely don't want to delete.