The “shutdown -r now” command is used to safely reboot a CentOS or RHEL server. The “-r” flag indicates that the system should reboot after shutting down all processes. The “now” argument tells the system to initiate the shutdown and reboot immediately.
Before running the command, it’s a good practice to check if there are any users currently connected to the server via the command “who” or “w” . This allows you to inform them of the upcoming reboot and give them time to save their work. Additionally, you can use the command “top” or “htop” to check if there are any critical processes running on the server. If there are any, you may want to wait until they have completed before rebooting the server.
The “reboot” command is also used to reboot a Linux system, it’s similar to “shutdown -r now” , it’s just a shorthand version of it.
Once you have verified that it’s safe to reboot, you can then run the “shutdown -r now” or “reboot” command as the root user to restart the server.