Travel is a feature in some NetHack ports that allows one to move quickly along any already explored path on the current level. NetHack uses a shortest-path algorithm to find a safe route to the destination, which is then carried out quickly. Your travel will be interrupted if something sufficiently "interesting" happens, as with the g command.
Travel is activated using the underscore _ key, then selecting a destination as for far look. Some ports allow travel to be activated by mouse-clicking (or touching with a touch-screen) on the destination.
The travel configuration option turns the travel command on/off. The runmode configuration option determines how often the screen updates when travelling and running.