Core files are very useful to debug program which are terminated abruptly.But the core files are larger in size. Due to the amount of space require to generate core file, it may require to change default core file path location to some other location.
Follow the steps to change default core file location to /tmp/user/
echo "/tmp/user/core.%p" > /proc/sys/kernel/core_pattern
Lets try something more interesting. Looking at the core pattern, one can identify following things.
1. Identify process ID (%p)
2. Identify Signal which caused dump (%s)
3. Identify Executable name (%e)
echo "/tmp/cores/%e_%s.%p" > /proc/sys/kernel/core_pattern
Write some buggy program and generate a core file.(Make sure that ulimit is set properly, otherwise core will not be generated. run 'ulimit -c unlimited' )
# ls /tmp/cores/ a.out_11.14564Details of the filename is as follows: -a.out is filename -signal caused dump is 11 -process id is 14564