I figured it might be diesel generators but I wonder how all that works. I am curious person. LOL
I know that on ships it is deisel generators.
All ships have electric generators to supply their own current. It is separate from the main engine so while the main engine is shut down they will still have electricity.
Yes there are usually several diesel generators to supply electricity. On older vessels a steam turbine drove a generator for power.