How to shutdown / reboot the remote Linux server from the CLI

To shutdown a remote Linux server from the command line, you can use the ssh command to remotely log into the server and then use the sudo command to run the shutdown command with the appropriate options.

For example, to shutdown the remote server immediately, you can run the following command:

 
ssh root@remote_server_ip 'sudo shutdown -h now'

To reboot the remote server, use the following command:

 
ssh root@remote_server_ip 'sudo shutdown -r now'

Note: Replace root and remote_server_ip with the actual username and IP address of the remote server.

Leave a Comment