The invention is directed to a distance sensor operating in accordance with the triangulation principle. The distance sensor has at least one pilot beam source which makes the imaging beam path of the sensor visible. The imaging beam path is inclined with respect to the measuring beam. A second pilot beam source is provided for the situation wherein the actual measuring beam of the sensor is not in the visible spectral region. A visible pilot beam is then superposed on the measuring beam.