Escherichia coli adapts its lifestyle to the variations of environmental growth conditions, swapping between swimming motility or biofilm formation. The stationary-phase sigma factor RpoS is an important regulator of this switch, since it stimulates adhesion and represses flagellar biosynthesis. By measuring the dynamics of gene expression, we show that RpoS inhibits the transcription of the flagellar sigma factor, FliA, in exponential growth phase. RpoS also partially controls the expression of CsgD and CpxR, two transcription factors important for bacterial adhesion. We demonstrate that these two regulators repress the transcription of fliA, flgM, and tar and that this regulation is dependent on the growth medium. CsgD binds to the flgM and fliA promoters around their -10 promoter element, strongly suggesting direct repression. We show that CsgD and CpxR also affect the expression of other known modulators of cell motility. We propose an updated structure of the regulatory network controlling the choice between adhesion and motility.