My question is probably not related to Ubuntu in particular, but since my desktop running this OS, I came to this forum.
I am trying to change the core file size using ulimit -c
command as follows:
$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 7959
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 1024
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
Changing the limitation:
$ ulimit -c unlimited
Observing the result:
$ ulimit -a
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 7959
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 1024
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
Indeed the limit is changed.
However, when I open another terminal and check the value, I still see zero value in core file size.
Questions:
- Are changes made using
ulimit
command affect only current process, i.e. in this case thebash
? - I launch a program from shell as a fore- or-background process. Does the
ulimit
change apply for new process ? - How can I make that all user processes are affected with this configuration ?
Best Answer
ulimit
is a shell builtin, and thus only affects the current shell, and processes started by that shell:From
man ulimit
:So, yes, child processes are affected.
To set limits permanently or for all processes, edit
/etc/security/limits.conf
and reboot. The examples in the manpage are fairly good. You just need to add something like: