How to Reboot from Command Line

System administrators and power users frequently need to restart computers remotely or through terminal interfaces. Understanding command line reboot options across different operating systems helps manage systems efficiently and securely.

Linux Command Line Reboot Options

The Linux operating system provides multiple commands for system reboots. The most basic command is reboot, which requires root privileges or sudo access:

bash
1sudo reboot

For more granular control, the shutdown command offers additional parameters. To restart immediately:

bash
1sudo shutdown -r now

The shutdown command accepts time delays and custom messages. For example, to schedule a reboot in 10 minutes with a warning message:

bash
1sudo shutdown -r +10 "System maintenance in progress"

Linux administrators should note that modern systemd-based distributions support the systemctl command:

bash
1sudo systemctl reboot

Windows Command Prompt and PowerShell

Windows systems support rebooting through both Command Prompt and PowerShell interfaces. From an elevated Command Prompt (run as Administrator):

cmd
1shutdown /r /t 0

The /r flag specifies restart, while /t 0 indicates immediate execution. For delayed reboots, modify the time value in seconds:

cmd
1shutdown /r /t 3600

PowerShell provides additional flexibility through the Restart-Computer cmdlet:

powershell
1Restart-Computer -Force

To restart a remote Windows machine, use:

powershell
1Restart-Computer -ComputerName "remote-pc-name" -Force

macOS Terminal Reboot Commands

Apple's macOS offers several terminal commands for system reboots. The basic command requires administrative privileges:

bash
1sudo reboot

The shutdown command provides more options:

bash
1sudo shutdown -r now

For scheduled reboots, specify a time using the at parameter:

bash
1sudo shutdown -r +30

Security Considerations

When implementing command line reboots, consider these security aspects:

  1. Always use sudo or appropriate administrative privileges
  2. Implement proper user authentication
  3. Monitor reboot logs for unauthorized attempts
  4. Use secure remote connections (SSH) for remote reboots

Remote System Management

For remote system administration, SSH provides secure access to Linux and macOS systems:

bash
1ssh username@remote-host "sudo reboot"

Windows systems typically use PowerShell remoting:

powershell
1Enter-PSSession -ComputerName "remote-pc"
2Restart-Computer -Force

Logging and Monitoring

Most operating systems maintain reboot logs. On Linux systems, check the system journal:

bash
1journalctl --boot

Windows administrators can access reboot events through Event Viewer or PowerShell:

powershell
1Get-EventLog -LogName System | Where-Object {$_.EventID -eq 1074}

Force Reboot Considerations

Force reboots should be used cautiously as they may lead to data loss. On Linux systems:

bash
1sudo reboot -f

For Windows systems:

cmd
1shutdown /r /f /t 0

Scheduling Periodic Reboots

Linux systems can schedule regular reboots using cron jobs. Add an entry to the root crontab:

bash
10 3 * * 0 /sbin/reboot

Windows Task Scheduler provides similar functionality through PowerShell:

powershell
1$trigger = New-JobTrigger -Weekly -DaysOfWeek Sunday -At 3am
2Register-ScheduledJob -Name "WeeklyReboot" -Trigger $trigger -ScriptBlock {Restart-Computer -Force}

Troubleshooting Common Issues

Command line reboots may fail due to locked files or running processes. For Linux systems, the lsof command identifies blocking processes:

bash
1sudo lsof | grep deleted

Windows administrators can use Task Manager or PowerShell to identify blocking applications:

powershell
1Get-Process | Where-Object {$_.MainWindowTitle -ne ""}

Related Tools

System administrators may find these tools helpful for managing reboots:

The Browser Information Analyzer helps identify system configurations before reboots.

For network-related issues during remote reboots, the What is my IP? tool can verify connectivity.

When scheduling reboots, the Unix Timestamp Converter assists in calculating precise timing.

Command line rebooting remains an essential skill for system administrators. Understanding the available commands and their implications across different operating systems enables efficient system management while maintaining security and stability.

Suggested Articles