I'm on Linux Mint 19 (Ubuntu 18 based). I wanted to have coredump
files in current folder. I had to do two things:
/proc/sys/kernel/core_pattern
(by # echo "core.%p.%s.%c.%d.%P > /proc/sys/kernel/core_pattern
or by # sysctl -w kernel.core_pattern=core.%p.%s.%c.%d.%P)
$ ulimit -c unlimited
That was written already in the answers, but I wrote to summarize succinctly. Interestingly changing limit did not require root privileges (as per https://askubuntu.com/questions/162229/how-do-i-increase-the-open-files-limit-for-a-non-root-user non-root can only lower the limit, so that was unexpected - comments about it are welcome).