The most common mechanism used by bacteria to swim through liquid media is the flagellum. The bacterial flagellum consists of 3 major domains: an ion driven motor, which can provide a torque in either direction; the hook, a universal joint which transmits motor torque even if it is curved; and the filament, a very long structure which acts as a propeller, and behaves differently depending on which way the motor turns.
When the bacterial flagellum is rotated by the motor, the filament forms a supercoil, giving it an overall corkscrew-like shape. Flagellated bacteria are able to undergo directed movement through changes in the rotary behavior of the flagellum. When the flagellum rotates clockwise, the filament forms a long pitch supercoil, allowing several flagella on a single cell to form a large bundle, which propels the bacterium along a straight line in a single direction. When the filament is rotated in the opposite direction, it forms a shorter pitch supercoil; this causes the flagellar bundle to disassemble, and the independent motion of several flagella on the cell cause it to tumble randomly. Using these two modes of motion, bacteria can move up or down a stimulus gradient by decreasing their tumbling frequency (if they are moving in the preferred direction) or increasing their tumbling frequency (if they are moving against the desired direction), allowing them to undergo a biased random walk.