Generally, olfaction, hearing, tactile perception, and vision are all important sensory modalities in mammals.
Olfaction plays a key role in many aspects of mammalian ecology, including foraging, mating and social communication. Many mammals use pheromones and other olfactory cues to communicate information about their reproductive status, territory, or individual or group identity. Scent-marking is commonly used to communicate among mammals. They are often transmitted through urine, feces, or the secretions of specific glands. Some mammals even use odors as defense against mammalian predators (e.g. skunks), which are especially sensitive to foul-smelling chemical defenses
Typically, mammalian hearing is well-developed. In some species, it is the primary form of perception. Echolocation, the ability to perceive objects in the external environment by listening to echoes from sounds generated by an animal, has evolved in several groups. Echolocation is the main perception channel used in foraging and navigation in microchiropteran bats (Chiroptera) and many toothed whales and dolphins (Odontoceti), and has also evolved to a lesser degree in other species (e.g., some shrews).
Many mammals are vocal, and communicate with one another or with heterospecifics using sound. Vocalizations are used in communication between mother and offspring, between potential mates, and in a variety of other social contexts. Vocalizations can communicate individual or group identity, alarm at the presence of a predator, aggression in dominance interactions, territorial defense, and reproductive state.
Mammals also perceive their environment through tactile input to the hair and skin. Specialized hairs (whiskers or "vibrissae") have a sensory function, letting an animal know when it is in contact with an object in its external environment. Vibrissae are often richly innervated and well-supplied with muscles that control their position. The skin is also an important sensory organ. Often, certain portions of the skin are especially sensitive to tactile stimuli, aiding in specific functions like foraging (e.g., the fingers of primates and the nasal tentacles of star-nosed moles). Touch also serves many communication functions, and is often associated with social behavior (e.g., social grooming).
Vision is well-developed in a large number of mammals, although it is less important in many species that live underground or use echolocation. Many nocturnal animals have relatively large, well-developed eyes. Vision can be important in foraging, navigation, entraining biological rhythms to day length or season, communication, and nearly all aspects of mammalian behavior and ecology.
The ecological roles, or niches, filled by the nearly 5000 mammal species are quite diverse. There are predators and prey, carnivores, omnivores, and herbivores, species that create or greatly modify their habitat and thus the habitat and structure of their communities [e.g., beavers damming streams, large populations of ungulates (Artiodactyla and Perissodactyla) grazing in grasslands, moles digging in the earth]. In part because of their high metabolic rates, mammals often play an ecological role that is disproportionately large compared to their numerical abundance. Thus, many mammals may be keystone predators in their communities or play important roles in seed dispersal or pollination. The ecosystem roles that mammals play are so diverse that it is difficult to generalize across the group. Despite their low species diversity, compared to other animal groups, mammals have a substantial impact on global biodiversity.