The linear-width of a graph G is defined to be the smallest integer k such that the edges of G can be arranged in a linear ordering (e 1 ,...,e r ) in such a way that for every i=1,...,r-1, there are at most k vertices incident to edges that belong both to {e 1 ,...,e i } and to {e i + 1 ,...,e r }. In this paper, we give a set of 57 graphs and prove that it is the set of the minimal forbidden minors for the class of graphs with linear-width at most two. Our proof also gives a linear time algorithm that either reports that a given graph has linear-width more than two or outputs an edge ordering of minimum linear-width. We further prove a structural connection between linear-width and the mixed search number which enables us to determine, for any k>=1, the set of acyclic forbidden minors for the class of graphs with linear-width=<k. Moreover, due to this connection, our algorithm can be transfered to two linear time algorithms that check whether a graph has mixed search or edge search number at most two and, if so, construct the corresponding sequences of search moves.