How to configure core are generated under specified directory in linux
In Linux we can configure the core dump location , so that we can assign a specific location on the linux os so that coredump(crash logs) are always written under specific directory in linux. To enable this follow below steps :
- Open .bashrc file under /root.(if this file is not available under /root then you can create one too.)
- Add the below lines to the file.
sysctl -w kernel.core_uses_pid=1
if [ ! -e /root/corefiles ]
mkdir -p /root/corefiles
echo /root/corefiles/core > /proc/sys/kernel/core_pattern
ulimit -c unlimited
This will enable all the process core dump (crash logs) to be written under /root/corefiles directory always.