Reversing engines.
There are a lot of variations in engines and couplings to propellers with multiple engines and reduction gearboxes.
The basic concept is solid drive from engine to propeller. When docking or manoeuvring into port the engine is stopped and started numerous times.
The engine room and bridge are connected by the Telegraph, you have seen them on the movies. The captain or pilot tells the engineers what he wants, ie " Slow Ahead". The engineer answers the call, by putting the ahead/astern lever in the ahead position., then he pushes the air start lever to air for a few seconds and then onto fuel. The engineer will maintain the engine rpm at about 30 rpm until another signal is received from the bridge. One of the engineers will be permanently at the control platform recording the time and engine movements received and delivered. The next movement will invariably be a stop and the fuel lever will be pulled back to the stop position.
If the bridge calls for "Astern" the astern lever is pushed to the astern position. The engines have two sets of cams next to each other on each camshaft. The reversing lever moves the camshaft to the other position where all the cams are in the position necessary to run astern. The engine is started normally. Some engines have a " lost motion" in the drive to the camshaft. When reversing the air start control reverses only and the engine rotates in the reverse direction until it catches up with the camshaft. The fuel cams are now in the position to run the other way.
Ships have little or no steering until they are moving quickly. But if they have a bit of momentum they will glide along for quite a way. If there is wind they react accordingly. A degree of steering can be achieved by turning the rudder and kicking the engine for just a few revs. The adept captain or pilot can steer the ship close to the wharf using rudder position and short bursts of engine revs, when they throw out lines and pull the ship up to the wharf. There is a lot at stake with damage to wharfs and ships that tugs are always on hand. Modern ships make use of directional pods, hence the less reliance on tugs.
A lot of modern ships are diesel electric where the diesels run continuously and the control is all electric.
All for now,
Phil R.