How to restart your Linux Machine?

 

Linux Server comes with numerous utilities and option that allow a server administrator to reboot or restart, shutdown or poweroff the system. In order to restart a Linux server or run reboot command, one must need to be member of wheel group.

 

Reboot Linux command

How to reboot a Linux server using command line method?  Or How do I remotely reboot or restart my CentOS powered Linux Dedicated server?

In order to reboot the server/system you can use the reboot or shutdown command available under Linux. Follow the below steps to perform these operations on your Server:

 

  • Clear cache to disk.

  • Log reboot/restart action which include a shutdown record in the accounting file called /var/run/utmp and /var/log/wtmp .

  • Kill or terminate all process with SIGTERM signal right after a SIGKILL signal.

  • At last, reboot the server.

 

Example of Reboot Command

First of all login to the root user. Enter the command given below to immediately reboot the system:

# reboot

Note, if you are not logged in as root user, you will see a message stating that  “must be superuser”.  Therefore login using sudo or su (Su forces one to share the root password details to other users) and than type the reboot command given above.

Example of Shutdown Command

Mostly, the shutdown command is used and suggested for rebooting  the system/server. This command can allow users advance notification so that those users can save their important work and cleanly terminating particular programs.  Follow the syntax given below:

 

shutdown -r time "message"

 

 

Steps to reboot a Server

You need to use the following command to reboot server immediate as root user:

# shutdown -r now

 

OR

# shutdown -r +0

Important: Reboot system with warning message (recommended)

In order to reboot the system in 5 minutes with the given below warning message:

# shutdown -r +5 "system is going down for kernel upgrade. Please save your important work ASAP (As soon as possible)."

Important: See/check log of system reboot

The final reboot command will display a log detail of all reboots since the log file was generated under Linux server, type:

# last reboot

Sample outputs will be like this:

 

Reboot Linux Server from remote

You need to use SSH client for logging into a remote Linux server and for performing reboot commands on a remote Linux server as given below:

ssh root@server1 /sbin/reboot

OR

ssh This email address is being protected from spambots. You need JavaScript enabled to view it. /sbin/reboot

OR

ssh This email address is being protected from spambots. You need JavaScript enabled to view it..1.2 /sbin/reboot

OR

ssh This email address is being protected from spambots. You need JavaScript enabled to view it. /sbin/shutdown -r now

 

A note about GUI (Graphical user interface) option

To reboot/restart the desktop system based upon Gnome:

Click on System > Shutdown > Reboot