Reboot/restart Linux System Command

Here is how to reboot a Linux system using various command-line options to reload a new Linux kernel or library such as libc.

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.

Linux system restart

To reboot Linux using the command line:

  1. To reboot the Linux system from a terminal session, sign in or “su”/”sudo” to the “root” account.
  2. Then type “sudo reboot” to reboot the box.
  3. Wait for some time and the Linux server will reboot itself.
  4. Are you using systemd based Linux distro? Try
    sudo systemctl reboot

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/reboot
OR use the full path:/sbin/shutdown -r now
You can also use sudo command under Ubuntu/Debian/Fedora and other Linux based distros:

sudo reboot
When prompted, you need to supply your account password:

[sudo] password for vivek:

The system will reboot if you have the correct sudo permission and the valid password. 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 {TIME}
In this example, the Linux server will restart in 5 minutes. During this time, all users will be logged out and any running processes will be stopped:

shutdown -r +10
Sample output:

Broadcast message from admin@sisrv.net
        (/dev/pts/1) at 12:08 ...

The system is going down for reboot in 10 minutes!

Where, options are as follows for the shutdown -r +10 command:

  • shutdown : This is the name of the Linux command to reboot the system.
  • -r : This option tells the system to restart your server or desktop.
  • +10 : This option tells the system to wait 10 minutes ({TIME}) before restarting. TIME may have different formats, the most common is simply the word “now” which will bring the system down or reboot 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 format.

You can pass the -c option to cancel a reboot or shutdown that is already in progress when time is set. For example:

shutdown -c

How do I reboot remote Linux server?

Simply login as the root user using ssh command:

ssh root@sisrv.net /sbin/reboot
OR

ssh root@sisrv.net /sbin/shutdown -r now
Sample outputs:

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-dns-name
OR ping -a server.ip.address.here
It is possible to use sudo command along with normal user over ssh session too. The syntax is:

ssh -t sisrv@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.

A note about systemctl command when using systemd

Are you using systemd as init on your Linux distro? Most modern Linux distro such as Debian, Ubuntu, CentOS, RHEL, Fedora, Arch, and many others uses systemd. Hence, we can use the following command to reboot the system. The syntax is:

sudo systemctl reboot

Booting into firemware system using the systemctl

It is possible to reboot the system into the firmware (BIOS) setup interface on modern servers, laptops, and desktops. Note that this functionality is not available on all systems. I tested with Dell, HP and other servers and notebooks, and it worked for me. The syntax is:

sudo systemctl reboot --firmware-setup
Please note that on modern Linux distro with systemd, reboot and shutdown are symlinks to the systemctl command. So you can type a combination of the ls command and which command to verify this easily. For example:

ls -l $(which poweroff halt reboot shutdown)
Here is what I see:

lrwxrwxrwx 1 root root 14 Mar  2 18:28 /usr/sbin/halt -> /bin/systemctl
lrwxrwxrwx 1 root root 14 Mar  2 18:28 /usr/sbin/poweroff -> /bin/systemctl
lrwxrwxrwx 1 root root 14 Mar  2 18:28 /usr/sbin/reboot -> /bin/systemctl
lrwxrwxrwx 1 root root 14 Mar  2 18:28 /usr/sbin/shutdown -> /bin/systemctl

You can use the command/type bash builtin too. For instnace:

type -a reboot
type -a poweroff
type -a halt

command -V shutdown

  • restart linux, reboot linux, system restart, linux restart, linux reboot, restart debian, reboot debian, sudo reboot
  • 22 Benutzer fanden dies hilfreich
War diese Antwort hilfreich?

Verwandte Artikel

SSH login without password

You want to use Linux and OpenSSH to automate your tasks. Therefore you need an automatic login...

How to remove a Linux user

How do I drop or remove old users account from my Linux server? I can login using the user’s SSH...

How to restrict and except SSH access to specific IPs

Once your IP is public it gets attention from so many bots in the internet that do brute force...

How to lock and unlock user account in linux

With the help of two commands you can lock and unlock the user account in Linux. To Lock the...

Adding a user to a group

Synopsis This article describes how to add a Linux user (account) to a group. Environment...

Powered by WHMCompleteSolution