Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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)

share|improve this question

1 Answer 1

up vote 4 down vote accepted

Or how can I be certain about some files that they are core dumps to delete them?

Use file to check this. It prints core file if your file is a core file: For example:

> 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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.