Peabody Energy, the largest US coal miner, filed for bankruptcy Wednesday, battered like the rest of the industry by competition from cheap natural gas and a push for cleaner energy.