How do I reboot my Linux based system? How do I reboot a remote Linux system or server using command line?
Linux comes with various utilities that allow a system administrator to reboot, halt or poweroff the system. One must be root or a member of the wheel group to run reboot command. This page shows how to reboot Linux based system using the command line.
Linux system restart
To reboot Linux using the command line:
- To reboot the Linux system from a terminal session, sign in or “su”/”sudo” to the “root” account.
- Then type “sudo reboot” to reboot the box.
- Wait for some time and the Linux server will reboot itself
Let us see examples in details.
Reboot Linux system command
You must login as root user to reboot the system. Open the terminal application (or login to remote box using ssh client) and type any one of the following command to reboot the system immediately:
# /sbin/shutdown -r now
You can also use sudo command under Ubuntu/Debian/Fedora and other Linux based distros:
$ sudo reboot
It is a good idea to provide notification to all logged-in users that the system is going down and, within the last five minutes of TIME, new logins are prevented. Type the following command:
# shutdown -r +5
Broadcast message from email@example.com (/dev/pts/1) at 13:21 ... The system is going down for reboot in 5 minutes!
TIME may have different formats, the most common is simply the word “now” which will bring the system down immediately. Other valid formats are +m, where m is the number of minutes to wait until shutting down and hh:mm which specifies the time on the 24hr clock.
How do I reboot remote Linux server?
Simply login as the root user using ssh command:
$ ssh root@remote-server-com /sbin/reboot
$ ssh root@remote-server-com /sbin/shutdown -r now
Connection to remote-server-com closed by remote host.
Get notification using the ping command when remote-server-com comes online:
ping -a remote-server-com
It is possible to use sudo command along with normal user over ssh session too. The syntax is:
$ ssh -t vivek@remote-server-com /sbin/reboot
Without the -t you will seen an error “sudo: no tty present and no askpass program specified“, hence you must pass the -t to the ssh command.
This page demonstrated how to use reboot command on Linux to reboot the server or desktop for software and kernel updates.