# .core files



## nu2fbsd (Sep 14, 2010)

Is there someway to put the *.core file/s in /tmp for auto deletion which are application crash files. I have used FBSD before (version 8.0) but did not see .core files, in 8.1 I am getting .core files.


----------



## SirDice (Sep 14, 2010)

An application core dump will be stored in whatever the current working directory is at that time. As far as I know you can't change that behavior.


----------



## Bunyan (Sep 14, 2010)

There is a way to avoid creation of core files.
Just add string *limit coredumpsize 0* to *.cshrc*


----------



## DutchDaemon (Sep 14, 2010)

Setting one of these in /etc/sysctl.conf is easier:


```
kern.coredump=0
```


```
kern.corefile=/dev/null
```


----------



## Beastie (Sep 14, 2010)

Of course the easiest and fastest solution is to disable the creation of core files once and for all.
But if you insist on moving them to /tmp, you can always use crontab(1) to `% find ~ -name '*.core' -exec mv {} /tmp \;` or so.

If you rarely had crashes before, you probably should investigate the reason for their sudden appearance.


----------



## rbelk (Sep 14, 2010)

There is no need to add another script to root's crontab. Just add the following entry into /etc/periodic.conf.


```
daily_clean_disks_files="[#,]* .#* a.out *.core *.CKP .emacs_[0-9]*"
```

You can define what ever you want to be cleaned from your filesystem. This entry is referenced by the file /etc/periodic/daily/100.clean-disks. It is run daily.

Please create the /etc/periodic.conf file and don't edit /etc/defaults/periodic.conf file.


----------



## Andrey Klyuchnikov (Feb 11, 2015)

`sysctl kern.corefile=/cores_dir/%N.core`


----------

