This works just like the search command, except that you will not find hidden/invisible monsters, and you will not search by touch if you are blind.
This saves you needing to manually use s to search nearby squares all the time, and is free – it does not cost extra time. Thus, you stand a much better chance of finding traps just before you stumble into them, and can also locate portals and hidden doors much more easily. (On the minus side, it could also cause you to find secret doors when, due to not wanting to deal with a known monster behind them, you would prefer they remain hidden. Similarly, it could reveal mimics or statue traps when you would rather let them lie.)
Automatic searching may be acquired as an intrinsic if you start out as a ranger, at level 9 as a monk, or at level 10 as an archaeologist, rogue, or tourist. Intrinsic automatic searching can also be gained if you succeed in digesting a ring of searching. Wearing the ring will give you automatic searching as an extrinsic, which costs you nutrition because you are wearing a ring, and prevents you from wearing other rings on that hand. Wielding Excalibur also grants this extrinsic, without the normal ring hunger.