Dealing with random crashes
Nothing is more infuriating than random crashes of a computer. If a crash is reproducible, you have somewhere to start looking, but if it happens at any time and using any software, where do you look? If it happens regardless of the software you are using, it may be a hardware problem. If you have a spare PSU, try swapping that. If it’s a laptop, the battery may be on the way out. If the computer doesn’t run reliably on battery power alone, look for a replacement battery. The other common culprit is faulty memory. Not all of it, just a few bytes. Testing memory on a running system is unreliable as you can't test anything the system needs, so use Memtest86+. This is a bootable system that uses minimal RAM for itself, leaving the rest available for testing. Memtest86+ runs a comprehensive series of tests and takes a while to run, but even that's not enough. Because such problems can be transient, there is a chance of faulty memory passing on a single run, so let it run for at least two passes and preferably overnight.
If neither of these show anything, you may have a problem with some core software. If you use a popular distro, that is unlikely without others also being affected. One other possibility is a dirty mains supply; voltage spikes or drops can trigger a reboot. Some sort of power smoothing, such as a UPS (Uninterruptible Power Supply) can eradicate such issues.