Enabling and testing core dumps in RHEL7/CentOS7

Temporarily enable core dumps:

sudo sh -c 'echo /tmp/core-%e-sig%s-user%u-group%g-pid%p-time%t > /proc/sys/kernel/core_pattern'
ulimit -c unlimited

Test creation of core dump file:

echo "int main() { int *p = 0; *p = 1; return 0; }" > crash.c
gcc -o crash crash.c
./crash

The output of this test should be “Segmentation fault (core dumped)” and you should get a file named something like “core-crash-sig11-user1000-group1000-…” in your /tmp/ directory.

Leave a Comment