Cleaning is a big part of owning an aquarium, since nearly every square inch of the system, including the rocks, gets coated with decaying organic matter and often algae as well. The best way to clean the rocks requires not heavy scrubbing but a little bit of duty each week.
Bacteria
You have to keep in mind that some bacteria are beneficial. No matter what type of rocks or cleaning method you use, your chore is not about scrubbing away as much bacteria as possible, it's about removing gunk while keeping beneficial bacteria alive. Deep-cleaning aquarium rocks to remove every trace of dirt can do more harm than good. Don't use any soaps, bleach, disinfectants or harsh cleaning methods. Aim to remove the unsightly stuff, like fish waste, slime and algae without wiping out the good bacteria that feed on fish waste.
Decorative Rocks
Clean your decorative rocks with an algae scraper or scrubber each week during water changes and you won't have to worry about spending much time clearing off scum. Use the tool to gently wipe off the surface of the rocks. Leave them in the tank if they are large, or pick them up. Swish them in the dirty water that you remove during a water change -- avoid washing them in tap water, which can kill good bacteria. If the rocks haven't been cleaned weekly and are really dirty, clean them gradually, removing about one-third of the algae or scum at each water change.
Live Rocks
Live rocks shouldn't be cleaned mechanically unless there's a serious problem in the tank and you don't have any other choice. Instead of scrubbing to remove algae or scum, set up an environment in your tank where the rocks receive a natural, biological cleaning. This means proper filtration, lighting, steady pH levels and fish that feed on algae. If you must clean live rocks, remove them from the tank and scrub them with a soft brush, then soak them in saltwater for two or three days. Be sure to aerate the water with an air stone during this time. Rinse the rocks in saltwater and return them to the tank.
Gravel
Gravel substrate, whether tiny shards or river rock pebbles, require cleaning much as decorative rocks do, except you'll use an aquarium vacuum instead of a scraper or scrubber. Dig the vacuum head deep into the gravel to capture organic waste that has filtered to the bottom. Clean about one-third of the gravel at each water change to avoid stirring up too much debris. If it's necessary to remove all of the gravel at one time to clean it, such as in the cases of severe algae blooms or cycling the tank from scratch, set aside a small amount of dirty gravel and mix it in with the cleaned gravel to restart the beneficial bacteria colony. Clean the gravel by putting it in a bucket and rinsing it under running water until it runs clear.