Following the previous notes about enabling core dump, here’s a note about changing the filename of core dump.
In Linux (since Linux 2.6 and 2.4.21)
you can change the core dump filename from the file /proc/sys/kernel/core_pattern
%% A single % character %p PID of dumped process %u real UID of dumped process %g real GID of dumped process %s number of signal causing dump %t time of dump (seconds since 0:00h, 1 Jan 1970) %h hostname (same as 'nodename' returned by uname(2)) %e executable filename
Linux have a default core filename pattern of “core”.
Alternatively, if /proc/sys/kernel/core_uses_pid contains a non-zero value, then the core dump file name will include a suffix .PID (process id), ex: core.PID
In FreeBSD, sysctl variable “kern.corefile” controls the filename of core dump.
Any sequence of %N in this filename template will be replaced by the process name, %P by the processes PID, and %U by the UID.
FreeBSD have a default core filename pattern of “%N.core”
You can include path in the filename pattern both in Linux and FreeBSD.
This make it possible to put core dump file in a separated directory.