A core file or core dump is a file that records the memory image of a running process and its process status, to find out getting a segmentation fault.

$ ulimit -c unlimited

then that will tell bash that its programs can dump cores of any size.  You can specify a size such as 52M instead of unlimited if you want. 

You can set core file size unlimited in your .bashrc file,

$ sudo vim ~/.bashrc
ulimit -c unlimited

$ sudo source ~/.bashrc

Get the coredump file from running process using below command,


gcore [file] : The optional argument file specifies the file name where to put the core dump.

You can generate a core dump for a hung process using this command,

gcore [PID]

$ gcore 12541

this command can take into account the value of the file /proc/pid/coredump_filter when generating the core dump

if gcore is not available on your system then

kill -ABRT <pid>

$ kill -ABRT 12181

Don't use kill -SEGV as that will often invoke a signal handler making it harder to diagnose the stuck process

Another way is configure in sysctl.conf to generate coredump with location, open a configuration file and add a line.

$ vim /etc/sysctl.conf


Then, run the command to save the configurations.

$ sysctl -p