No announcement yet.

How to check the shutdown status


Unconfigured Ad Widget

  • Filter
  • Time
  • Show
Clear All
new posts

  • How to check the shutdown status

    Hi, I have migrated from Microsoft to Linux, can anyone tell me about the shutdown command in Linux? How to check shutdown status & what are the different levels of shutdown command?

  • #2
    The shutdown command serves the purpose of safely halting the operating system. It can be executed either immediately or scheduled in a 24-hour format.
    Important Note: Only the Root user can perform the shutdown command.

    Syntax Of shutdown command:

    shutdown [OPTIONS] [TIME] [MESSAGE]

    options – The shutdown command offers options to halt, power off (default option), or reboot the system.
    Time: You can schedule to execute the shutdown at a specific time.
    Message – A message for all users.

    As soon as the shutdown command is initiated, a notification is broadcasts to all active user sessions, informing them of the system shutdown.

    The signal SIGTERM will be sent to all running processes, informing them of the system shutdown and allowing them to save and exit properly.

    The shutdown command signals the init process to initiate a change in the runlevel.

    Runlevel 0 halts the system.
    Runlevel 1 is the default state.
    Runlevel 6 reboots the system.

    When a shutdown is scheduled for the future, the file /etc/nologin is created five minutes before the start of the shutdown sequence, which prevents new user logins.

    To power off the machine:
    sudo shutdown

    To shutdown at a specific time:
    sudo shutdown 04:00

    To shutdown immediately:
    sudo shutdown now

    To shutdown at a particular time with a custom message:
    sudo shutdown +15 "Server is going down for maintenance. Please save your work ASAP".
    This command will shutdown after 15 mins and will broadcast message to all the active users.

    To see the log of the Linux system shutdown:
    # last reboot
    # last reboot|head -1
    (head to get the last shutdown only. Head -2 will display the last two shutdowns, and -3 will display the last three shutdowns)
    # last shutdown
    # last -x shutdown