Shutdown Command in Windows and Linux

0

Shutdown Command in Windows

In Windows, the shutdown command is used to power off, restart, or log off the system. It can also be used to schedule shutdowns or display a message to users.

Shutdown Command in Windows and Linux
Shutdown Command in Windows and Linux

Syntax for Windows Shutdown Command

shutdown [/i | /l | /s | /r | /g | /a | /p | /h | /e] [/f] [/m \\computer] [/t xxx] [/d [p:|u:]xx:yy] [/c "comment"]

Common Options in Windows

  • /s: Shuts down the computer.
    Example: shutdown /s
  • /r: Restarts the computer.
    Example: shutdown /r
  • /l: Logs off the current user.
    Example: shutdown /l
  • /a: Aborts a scheduled shutdown.
    Example: shutdown /a
  • /t xxx: Sets a delay of xxx seconds before shutting down or restarting.
    Example: shutdown /r /t 60 (restarts after 60 seconds).
  • /f: Forces running applications to close without warning.
    Example: shutdown /s /f
  • /c "comment": Adds a comment (up to 512 characters) to explain the reason for the shutdown.
    Example: shutdown /s /t 30 /c "System is shutting down for maintenance."
  • /h: Puts the computer into hibernation (if enabled).
    Example: shutdown /h

Examples in Windows

  • Shut down the computer immediately:
    shutdown /s
  • Restart the computer after 60 seconds:
    shutdown /r /t 60
  • Abort a scheduled shutdown:
    shutdown /a
  • Forcefully shut down the computer:
    shutdown /s /f
  • Schedule a shutdown with a message:
    shutdown /s /t 300 /c "System will shut down in 5 minutes. Save your work."

Shutdown Command in Kali Linux (or any Linux-based OS)

In Kali Linux (or any Linux distribution), the shutdown command is used to power off, restart, or schedule a shutdown of the system.

Syntax for Linux Shutdown Command

shutdown [OPTIONS] [TIME] [MESSAGE]

Common Options in Linux

  • -h or --halt: Halts the system (shuts down but does not power off).
    Example: shutdown -h now
  • -P or --poweroff: Powers off the system (default behavior).
    Example: shutdown -P now
  • -r or --reboot: Reboots the system.
    Example: shutdown -r now
  • -c or --cancel: Cancels a scheduled shutdown.
    Example: shutdown -c
  • -k: Sends a warning message to all users without actually shutting down.
    Example: shutdown -k "System will shutdown soon"
  • TIME: Specifies when to shut down the system. It can be:
    • now: Shuts down immediately.
    • +m: Shuts down after m minutes (e.g., +5 for 5 minutes).
    • hh:mm: Shuts down at a specific time in 24-hour format (e.g., 23:00).
  • MESSAGE: A custom message to broadcast to all users before shutting down.
    Example: shutdown -r +10 "System will reboot in 10 minutes for maintenance."

Examples in Linux

  • Shut down the system immediately:
    shutdown now
  • Reboot the system in 5 minutes:
    shutdown -r +5
  • Schedule a shutdown at 10:00 PM:
    shutdown 22:00
  • Cancel a scheduled shutdown:
    shutdown -c
  • Send a warning message without shutting down:
    shutdown -k "System will shutdown soon. Save your work."

Key Differences Between Windows and Linux Shutdown Commands

Feature Windows Linux
Immediate Shutdown shutdown /s shutdown now
Restart shutdown /r shutdown -r now
Delay Shutdown shutdown /s /t 60 shutdown +1
Cancel Shutdown shutdown /a shutdown -c
Custom Message shutdown /s /t 60 /c "message" shutdown +5 "message"

Additional Notes

  • In Linux, you need root or sudo privileges to use the shutdown command.
  • In Windows, you need administrator privileges to use the shutdown command.
Shutdown Command in Windows and Linux
Shutdown Command in Windows and Linux


Post a Comment

0Comments
Post a Comment (0)

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Accept !
✨ Updates