Linux Reboot Command Example

How do I reboot my HP Linux server using command line option? How do I remotely reboot my CentOS or Debian based Linux server?

You can use the reboot or shutdown command under Linux to saftly reboot the desktop or server system. These utilties performces the following operations:

  1. Flush cache to disk.
  2. Log reboot action including entering a shutdown record into the user accounting file called /var/run/utmp and /var/log/wtmp .
  3. Kill all process with a SIGTERM single followed by a SIGKILL single.
  4. Finally, reboot the server.

reboot command example

First, login as the root user. Type the following command to immediately reboot the system:
# reboot
Please note that if you are not the root user, you will get the message ‘must be superuser. So login using sudo or su and than type the reboot command.

shutdown command example

Normally, the shutdown command is used and recommended for rebooting the system. This command can give users advance warning so that they can save their work and cleanly terminating specific programs. The syntax is as follows:

shutdown -r time "message"


  • -r : Reboot the system.
  • time : When to reboot. You can reboot immediately or after 2 minutes. It can be an absolute time in the format hh:mm, in which hh is the hour (1 or 2 digits) and mm is the minute of the hour (in wo digits). Second, it can be in the format +m, in which m is the number of minutes to wait. The word now is an alias for +0.
  • message: Send warning message to send to all users.

Steps to reboot the system

Use the following command to reboot system immediate as root user:
# shutdown -r now
# shutdown -r +0

Task: Reboot with warning message (recommended)

To reboot system in 5 minutes with the following warning message:
# shutdown -r +5 "Server is going down for kernel upgrade. Please save your work ASAP."

Task: See log of system reboot

The last reboot command will show a log of all reboots since the log file was created under Linux, enter:
# last reboot
Sample outputs:

Fig.01: Linux Reboot Command Line Log Using last Command

Taks: Reboot remote Linux server

Use SSH client for logging into a remote Linux machine and for executing reboot commands on a remote Linux system as follows:
ssh root@server1 /sbin/reboot
ssh /sbin/reboot
ssh root@ /sbin/reboot
ssh /sbin/shutdown -r now

A note about GUI option

To reboot the desktop system based upon Gnome:
Click on System > Shutdown > Reboot

Fig.02: Linux Gnome Desktop Shutdown Options

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 6 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
6 comments… add one
  • H23x56952p3jbf May 6, 2012 @ 10:42

    or with magix key
    alt+sysRQ+ r
    alt+sysRQ+ e
    alt+sysRQ+ i
    alt+sysRQ+ s
    alt+sysRQ+ u
    alt+sysRQ+ b

  • Abramo Jun 6, 2014 @ 18:33

    Excellent! Thanks for providing.

  • Rajasekaran S Jan 14, 2015 @ 8:14

    thanks. it works

  • jahman Jan 14, 2015 @ 13:12

    if the reboot or init command stuck in a ssh session:

    echo s > /proc/sysrq-trigger # Flusher les buffers d’IO pour ne pas perdre de données
    echo u > /proc/sysrq-trigger # Démonter puis Remonter toutes les partitions en Read-Only
    echo b > /proc/sysrq-trigger # Forcer le reboot de la machine

  • christelle Oct 8, 2015 @ 8:35

    Good morning urgent!!!!
    please i have a problem with the use of my centreon server since some whlie now i can acess the server either by it name or it Ip address. it continu to work in background but can’t access it.
    how do i restart my Centreon server in command line whithout shuting down the server itself.

  • Matthew Fritz Mar 15, 2016 @ 14:45

    Thank you for this. Exactly what I was looking for.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum