Microbial ecology (or environmental microbiology) is the ecology of microorganisms: their relationship with one another and with their environment. It concerns the three major domains of life—Eukaryota, Archaea, and Bacteria—as well as viruses.
Microorganisms, by their omnipresence, impact the entire biosphere. Microbial life plays a primary role in regulating biogeochemical systems in virtually all of our planet's environments, including some of the most extreme, from frozen environments and acidic lakes, to hydrothermal vents at the bottom of deepest oceans, and some of the most familiar, such as the human small intestine. As a consequence of the quantitative magnitude of microbial life (calculated as 5.0×1030 cells; eight orders of magnitude greater than the number of stars in the observable universe) microbes, by virtue of their biomass alone, constitute a significant carbon sink. Aside from carbon fixation, microorganisms' key collective metabolic processes (including nitrogen fixation, methane metabolism, and sulfur metabolism) control global biogeochemical cycling. The immensity of microorganisms' production is such that, even in the total absence of eukaryotic life, these processes would likely continue unchanged.
While microbes have been studied since the seventeenth-century, this research was from a primarily physiological perspective rather than an ecological one. For instance, Louis Pasteur and his disciples were interested in the problem of microbial distribution both on land and in the ocean. Martinus Beijerinck invented the enrichment culture, a fundamental method of studying microbes from the environment. He is often incorrectly credited with framing the microbial biogeographic idea that "everything is everywhere, but, the environment selects", which was stated by Lourens Baas Becking. Sergei Winogradsky was one of the first researchers to attempt to understand microorganisms outside of the medical context—making him among the first students of microbial ecology and environmental microbiology—discovering chemosynthesis, and developing the Winogradsky column in the process.:644
Beijerinck and Windogradsky, however, were focused on the physiology of microorganisms, not the microbial habitat or their ecological interactions. Modern microbial ecology was launched by Robert Hungate and coworkers, who investigated the rumen ecosystem. The study of the rumen required Hungate to develop techniques for culturing anaerobic microbes, and he also pioneered a quantitative approach to the study of microbes and their ecological activities that differentiated the relative contributions of species and catabolic pathways.
Microorganisms are the backbone of all ecosystems, but even more so in the zones where photosynthesis is unable to take place because of the absence of light. In such zones, chemosynthetic microbes provide energy and carbon to the other organisms. These chemotrophic organisms can also function in environments lacking oxygen by using other electron acceptors for their respiration.
Other microbes are decomposers, with the ability to recycle nutrients from other organisms' waste products. These microbes play a vital role in biogeochemical cycles. The nitrogen cycle, the phosphorus cycle, the sulphur cycle and the carbon cycle all depend on microorganisms in one way or another. For example, the nitrogen gas which makes up 78% of the earth's atmosphere is unavailable to most organisms, until it is converted to a biologically available form by the microbial process of nitrogen fixation.
Microbes, especially bacteria, often engage in symbiotic relationships (either positive or negative) with other microorganisms or larger organisms. Although physically small, symbiotic relationships amongst microbes are significant in eukaryotic processes and their evolution. The types of symbiotic relationship that microbes participate in include mutualism, commensalism, parasitism, and amensalism, and these relationships affect the ecosystem in many ways.
Mutualism in microbial ecology is a relationship between microbial species and between microbial species and humans that allow for both sides to benefit. One such example would be syntrophy, also known as cross-feeding, of which 'Methanobacterium omelianskii ' is a classical example. This consortium is formed by an ethanol fermenting organism and a methanogen. The ethanol-fermenting organism provides the archaeal partner with the H2, which this methanogen needs in order to grow and produce methane. Syntrophy has been hypothesized to play a significant role in energy- and nutrient-limited environments, such as deep subsurface, where it can help the microbial community with diverse functional properties to survive, grow and produce maximum amount of energy. Anaerobic oxidation of methane (AOM) is carried out by mutualistic consortium of a sulfate-reducing bacterium and an anaerobic methane-oxidizing archaeon.  The reaction used by the bacterial partner for the production of H2 is endergonic (and so thermodynamically unfavored) however, when coupled to the reaction used by archaeal partner, the overall reaction becomes exergonic. Thus the two organisms are in a mutualistic relationship which allows them to grow and thrive in an environment, deadly for either species alone. Lichen is an example of a symbiotic organism.
Commensalism is very common in microbial world, literally meaning "eating from the same table". Metabolic products of one microbial population are used by another microbial population without either gain or harm for the first population. There are many "pairs "of microbial species that perform either oxidation or reduction reaction to the same chemical equation. For example, methanogens produce methane by reducing CO2 to CH4, while methanotrophs oxidize methane back to CO2. 
Amensalism (also commonly known as antagonism) is a type of symbiotic relationship where one species/organism is harmed while the other remains unaffected. One example of such a relationship that takes place in microbial ecology is between the microbial species Lactobacillus casei and Pseudomonas taetrolens. When co-existing in an environment, Pseudomonas taetrolens shows inhibited growth and decreased production of lactobionic acid (its main product) most likely due to the byproducts created by Lactobacillus casei during its production of lactic acid. However, Lactobacillus casei shows no difference in its behaviour, and such this relationship can be defined as amensalism.
Biotechnology may be used alongside microbial ecology to address a number of environmental and economic challenges. For example, molecular techniques such as community fingerprinting or metagenomics can be used to track changes in microbial communities over time or assess their biodiversity. Managing the carbon cycle to sequester carbon dioxide and prevent excess methanogenesis is important in mitigating global warming, and the prospects of bioenergy are being expanded by the development of microbial fuel cells. Microbial resource management advocates a more progressive attitude towards disease, whereby biological control agents are favoured over attempts at eradication. Fluxes in microbial communities has to be better characterized for this field's potential to be realised. In addition, there are also clinical implications, as marine microbial symbioses are a valuable source of existing and novel antimicrobial agents, and thus offer another line of inquiry in the evolutionary arms race of antibiotic resistance, a pressing concern for researchers.
Microbes exist in all areas, including homes, offices, commercial centers, and hospitals. In 2016, the journal Microbiome published a collection of various works studying the microbial ecology of the built environment.
A 2006 study of pathogenic bacteria in hospitals found that their ability to survive varied by the type, with some surviving for only a few days while others survived for months.
The lifespan of microbes in the home varies similarly. Generally bacteria and viruses require a wet environment with a humidity of over 10 percent. E. coli can survive for a few hours to a day. Bacteria which form spores can survive longer, with Staphylococcus aureus surviving potentially for weeks or, in the case of Bacillus anthracis, years.
In the home, pets can be carriers of bacteria; for example, reptiles are commonly carriers of salmonella.
S. aureus is particularly common, and asymptomatically colonizes about 30% of the human population; attempts to decolonize carriers have met with limited success and generally involve mupirocin nasally and chlorhexidine washing, potentially along with vancomycin and cotrimoxazole to address intestinal and urinary tract infections.
Some metals, particularly copper and silver, have antimicrobial properties. Using antimicrobial copper-alloy touch surfaces is a technique which has begun to be used in the 21st century to prevent transmission of bacteria. Silver nanoparticles have also begun to be incorporated into building surfaces and fabrics, although concerns have been raised about the potential side-effects of the tiny particles on human health.