To restart a UNIX system or server, you can use the shutdown
command with the appropriate options. The shutdown
command is used to halt or reboot the system.
To restart the system immediately, use the following command as the root user:
shutdown -r now
This command instructs the system to reboot immediately.
You can also specify a delay before the system is rebooted. For example, to restart the system in 10 minutes, use the following command:
shutdown -r +10
This command instructs the system to reboot in 10 minutes.
If you want to broadcast a message to all logged in users before the system is rebooted, use the -k
option. For example, to reboot the system in 5 minutes and broadcast a message to all logged in users, use the following command:
shutdown -r +5 "The system is going down for a reboot" -k
This command broadcasts a message to all logged in users, waits for 5 minutes, and then reboots the system.
Note that restarting a system can cause data loss and should be done with care. Always make sure that any important data has been saved and that all running processes have been stopped before restarting the system.