Hard drives are fragile and complex devices that do not have an infinite life span. Unfortunately. Not to scare our readers, but hard drives are one of the most likely things that could go wrong with your computer, as I am finding out right now with one of my machines.
Modern hard drives can however tell you quite a bit about how they're doing and show you some statistics about themselves. It won't necessarily give you a realistic guess of when your drive is going to die, but it can help to keep tabs on things nevertheless.
The smartctl command is part of the smartmontools package and can tell you quite a bit about the drive. There are several different command line switches you can give it. Note that your distribution will have to have support for SMART and also your hard drives need to be fairly recent for this to work. You also probably need to be root or use sudo.
A quick way to see if the drive's internal electronics think things are OK or not OK is to run a quick health check. You'll need to know which drive you're talking about (in my case hda as it is the first IDE device). Remember if you have a different drive setup (such as SATA), you'll have a different
# smartctl -H /dev/hda
Or, you can get some more detailed statistics by using the -A switch (which stands for attributes):
# smartctl -A /dev/hda
Or if you're in the mood to decypher lots of technical information, you can get all the available information from your drive. Not for the faint hearted.
# smartctl --all /dev/hda
For more information about using and decyphering the results of smartctl, consult the man page (man smartctl) or the online man page.