The locomotive is the part of the train that provides motive power. Typically it is located in the front and pulls the train, but sometimes it is located in the back and pushes. Larger trains may have more than one engine. Trains were originally driven by steam-powered locomotives. Starting in the 1920s, these were replaced with diesel locomotives, although some examples of steam locomotives can still be found in use today. Railway lines that see high traffic have switched from diesel to electric power in modern times. An electric train receives power either from an overhead line or a ground-based third rail.
Rails are what a train runs on. These are made of metal and laid on a prepared bed to secure them in place. The wheels of the locomotive and train cars are grooved to fit the rails, allowing them to grip them. Another rail-related issue is the rail gauge, or the distance between the rails. This sometimes varies between systems, and in inefficient examples even within countries, and hinders interoperability between rail networks.
Locomotives pull rail cars, which are the body of the train. In a passenger train, these will be passengers cars. For a commuter train these cars will be situated with rows of seas for maximum comfortable carriage of a relatively short distance. Inter-city or long distance trains may have sleeper, lounge and dining cars as well. Freight trains will have various types of cargo-carrying cars, such as box cars, flatbed cars and tankers. Rail cars are joined together by couplings. A coupling is also used to attach the cars at the ends of the train to the locomotive. These mechanisms are just as important for rail interoperability as the rail gauge, since incompatible couplings cannot be joined together.