5. As shown in Figure 1, in the right triangle $\triangle ABC$, $AC=1, BC=$ $2, P$ is a moving point on the hypotenuse $AB$. Draw $PE \perp BC, PF$ $\perp AC$, with the feet of the perpendiculars being $E$ and $F$, respectively, and connect $EF$. Then the minimum length of the line segment $EF$ is $\qquad$
5. $\frac{2}{\sqrt{5}}$.

From the problem, we know that the hypotenuse $A B=\sqrt{5}$.
Since $E F=C P$, therefore,
$E F$ is shortest $\Leftrightarrow C P$ is shortest $\Leftrightarrow C P \perp A B$. Hence, the minimum length of $E F$ is $\frac{1 \times 2}{\sqrt{5}}=\frac{2}{\sqrt{5}}$.