Besides the water torture of a dripping faucet, I can't think of anything more maddening than a squeaky floor. It announces all arrivals and departures, no matter the time of day. Many a homeowner tears up their carpet to try and isolate the source of the creak or waits until they can't stand it anymore and considers a costly new floor project.
Fortunately, you may not have to go to such extremes. My friend Robert, a carpenter with more than his share of home remedies, sold me on the idea of ring-shank finishing nails. You can find them practically anywhere, and there are sizes with circumferences so small, they go right through your carpet without leaving a perceptible hole in it.
Hammering Down the Solution
First, you need to isolate the floor boards that are the source of your troubles. You probably already have them memorized. The rink-shank nail has a sharp point and circular threads. You can punch it with a hammer and awl (if necessary) through the carpet, into the floor, and down through the floor into the subfloor surface. That holds the nasty squeakers in place. Beware: some nails come with heads so large they can leave a small impression on the carpet.
One manufacturer actually sells a floor kit that comes with the threaded nails and a tripod that fits over the nail-head so you can snap it off after you pound it into the floor. If the noise is created by a space between the floorboard and the joist, you can fill the gap with shims to take up the throw.
A Worst-Case Flooring Scenario
The noise may actually be a sign of a more serious problem. If there are sagging sections in the floor, you may have a problem with rotting in the subfloor. Now you need to call in a flooring carpenter or other expert to remove and replace sections where there is little other remedy.
Some DIYers recommend liquid graphite to lubricate seams in the flooring where wood rubs against wood, but it's messy and tends to sit on the surface. You might consider powdered graphite, which can penetrate into the seams. For bare floors, try finishing nails with square drive heads, but you have to pre-drill the holes and lubricate the screws with wax.
Maybe you want to consider replacing damaged flooring with "green" materials and circumvent the squeaking problem entirely.