It’s easy to shut down Linux machine in ssh.
$ sudo shutdown
But you would have to wait for a minute for the system to shut down. If you want it to shut down right away, run the following command.
$ sudo shutdown -h now
If you want to restart your Linux machine, here is the command.
$ sudo reboot