A tunnel is an underground passageway, dug through the surrounding soil/earth/rock and enclosed except for entrance and exit, commonly at each end.
A pipeline is not a tunnel, though some recent tunnels have used immersed tube construction techniques rather than traditional tunnel boring methods.
A tunnel may be for foot or vehicular road traffic, for rail traffic, or for a canal.
Tunnels are often the only way to avoid steep gradients by passing under elevations. They are used for various types of land transport.
Canals are built for ships transporting goods and people. Obviously canals are always horizontal, the only way to climb a mountainside are locks. Locks are time consuming, expensive, need energy (often powered by the water from the canal). So the constructors of canals tried to avoid a lot of locks by constructing tunnels through the hills. Those tunnels are a typical Victorian construction, connected with early industrialization, as the canals were of great importance for the transport of coal and ores. Most canal tunnels exist in Great Britain, some more in France, but other European have only very few (Germany: 1). Outside of Europe they are almost unknown.
Railroads are not able to climb high pitches so the necessity to build railroad tunnels arose early after the invention of the railroad in the 19th century. Many railroad tunnels were built during the 19th century all over the world, but most of them in Europe.
Later, in the 20th century road tunnels became much more important. Today the number of road tunnels worldwide is enormous. But as they typically are no tourist sights, there are only a few extraordinary road tunnels listed on showcaves.com.
Pedestrian tunnels are especially important in large cities. They allow pedestrians to avoid intersections with other types of traffic, thus increasing pedestrian safety while improving traffic flow. But there are also pedestrian tunnels for crossing bodies of water, hills or buildings. And escape tunnels also belong to this category.
The tunnels were originally built using techniques known from mining. Miners dug the tunnels in the same way they had previously built their mine tunnels. A construction method that has been used for thousands of years and is typical for tunnels is the qanat construction method. In this method, a series of shafts was sunk along a line and at the bottom the tunnel was driven in both directions. This offers many advantages; in the past, the most important was that it compensated for inaccuracies in surveying. The construction time is also shortened because all segments are built at the same time. This technique is still used today, the new Gotthard Base Tunnel was built in this way.
But modern technology also offers new techniques for building tunnels. Huge drilling machines bore into the rock, remove the material, use some of the rock and additional material such as cement to make concrete, support the ceiling with a hydraulic system that also forms the mould for the concrete. Such tunnel boring machines are sometimes a hundred metres long and at their end the tunnel is almost finished. They simultaneously drill and make the lining for the tunnel as they move forward.