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

I

am a new Linux sysadmin. How do I remotely shutdown or reboot the server from the CLI?

 

For stopping and restating the system use any one of the following command:

halt command – stopping the system i.e. the system is powered off.

reboot command – Restarting the system.

shutdown command – The shutdown utility provides an automated shutdown procedure for super-users to nicely notify users when the system is shutting down, saving them from system administrators, hackers, and gurus, who would otherwise not bother with such niceties.

First, you need to ssh into the remote box and issue the following commands.

How to reboot the remote Linux server

The syntax is:

ssh user@server-name-here

 

Type the following command to reboot the box:

sudo reboot

 

Another option is:

ssh -t vivek@server1.cyberciti.biz  sudo reboot

 

OR use the shutdown command:

ssh -t vivek@server1.cyberciti.biz  sudo shutdown -r 0

 

OR

ssh -t vivek@server1.cyberciti.biz  sudo shutdown -r now

 

Sample outputs:

[sudo] password for vivek:

Connection to server1.cyberciti.biz closed by remote host.

Connection to server1.cyberciti.biz closed.

You must pass the -t option to the ssh command to force pseudo-terminal allocation. The shutdown accepts -r option i.e. Linux is rebooted at the specified time. A value of zero indicates reboot the machine immediately.

How to shutdown the remote Linux server

The syntax is:

ssh user@server-name-here

 

Type the following command to reboot the box:

sudo halt

 

Another option is:

ssh -t vivek@server1.cyberciti.biz  sudo halt

 

OR use the shutdown command:

ssh -t vivek@server1.cyberciti.biz  sudo shutdown -h 0

 

OR

ssh -t vivek@server1.cyberciti.biz  sudo shutdown -h now

 

You must pass the -t option to the ssh command to force pseudo-terminal allocation. The shutdown accepts -h option i.e. Linux is powered/halted at the specified time. A value of zero indicates poweroff the machine immediately.

Use IPMI to shutdown/reboot server

The Intelligent Platform Management Interface (IPMI) allows you to control power of your server using the CLI or web interface. For example one can login to IPMI web interface and issue the command:

Fig.01: Use IPMI to perform a power control operation on your server

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *