Can I be sure that files with name
core on the system are core dump files? Or how can I be certain about some files that they are core dumps to delete them? (best practices are welcome)
Or how can I be certain about some files that they are core dumps to delete them?
file to check this. It prints
core file if your file is a core file:
> file ./core.17511 ./core.17511: ELF 64-bit LSB core file x86-64, version 1 (SYSV), SVR4-style, from './main'
This is what
man file says:
file tests each argument in an attempt to classify it.
The type printed will usually contain one of the words text (the file contains only printing characters and a few common control characters and is probably safe to read on an ASCII terminal), executable (the file contains the result of compiling a program in a form understandable to some UNIX kernel or another), or data meaning anything else (data is usually 'binary' or non-printable). Exceptions are well-known file formats (core files, tar archives) that are known to contain binary data.