I’ve been doing a log of programming at work and some of the worst errors to run into are segfaults or segmentation faults. This deals with problems in your logic and more often then not is a memory issue. They really suck to debug…
For best practices, I keep a working version and development version of code. This way, when I run into these problems I can compare my issues against a working copy. I use none other than the great diff command. This sometimes helps with faults among other debugging tools like (gdb).
It’s pretty obvious by the name what this command does, it points out the differences between files.
diff <FILE 1> <FILE 2>
The example points out a line that is different between two given files. New lines can really screw up the results so be careful.
That’s the gist, visit the it’s man page for more details.