The fastest way to restart your computer without using the mouse

You can restart your computer entirely from the command line using a single command, without touching the graphical interface. On Windows, the command is shutdown /r /t 0. On Mac or Linux, the command is sudo shutdown -r now. Both commands restart the computer when ready — the /t 0 on Windows and the "now" on Mac and Linux both mean zero delay. This is useful when your mouse or trackpad stops working, when you need to restart in a script or batch file, or when you want to restart a computer remotely.

The command line is a text-based way to give your operating system instructions. Instead of clicking icons, you type commands and press Enter. Most people never need to use it, but it is often faster for specific tasks like restarting, and it works even when the graphical interface is frozen or unresponsive.

Key Takeaways

  • On Windows, open Command Prompt or PowerShell and type shutdown /r /t 0 to restart when ready.
  • On Mac or Linux, open Terminal and type sudo shutdown -r now to restart when ready.
  • You can add a delay by changing the number in the Windows command — for example, shutdown /r /t 60 restarts after 60 seconds.
  • To cancel a restart you have already scheduled, use shutdown /a on Windows or sudo shutdown -c on Mac and Linux.
  • If you are restarting a computer you do not own or manage, ask the owner or administrator first.

How to restart Windows from Command Prompt

Open Command Prompt by pressing the Windows key, typing "cmd", and pressing Enter. A black window will appear with a blinking cursor. Type shutdown /r /t 0 and press Enter. Your computer will restart when ready.

If you want a delay before the restart — for example, to save your work — replace the 0 with the number of seconds you want to wait. shutdown /r /t 120 gives you 2 minutes. Windows will display a notification on your screen counting down the time remaining.

If you change your mind, open Command Prompt again and type shutdown /a. This cancels the scheduled restart. You must do this before the countdown reaches zero.

How to restart Windows from PowerShell

PowerShell is a more advanced command-line tool built into modern Windows. Press the Windows key, type "powershell", and press Enter. Type Restart-Computer -Force and press Enter. The -Force flag tells Windows to restart when ready without saving open files, so use it only when necessary.

If you want to give yourself time to save work, use Restart-Computer without the -Force flag. Windows will wait for programs to close on their own, though this can take several minutes if a program is not responding.

How to restart Mac from Terminal

Open Terminal by pressing Command + Space, typing "terminal", and pressing Enter. Type sudo shutdown -r now and press Enter. Your Mac will ask you to enter your password — this is the password you use to log in to your Mac. Type it and press Enter. Your Mac will restart when ready.

The word "sudo" means "superuser do" — it tells the Mac you have permission to run this command. Without it, the command will not work. The -r flag means restart, and "now" means do it when ready.

If you want a delay, replace "now" with the number of minutes. sudo shutdown -r +5 restarts in 5 minutes. To cancel, type sudo shutdown -c before the time runs out.

How to restart Linux from Terminal

Open Terminal — the method varies by Linux distribution, but usually you can right-click the desktop and select "Open Terminal Here", or press Ctrl + Alt + T. Type sudo shutdown -r now and press Enter. Enter your password when prompted. Your computer will restart when ready.

Like Mac, Linux uses "sudo" to grant permission and -r to restart. If you want a delay, use sudo shutdown -r +10 to restart in 10 minutes. To cancel a scheduled restart, type sudo shutdown -c.

Some Linux systems use reboot instead of shutdown. Type sudo reboot and press Enter. This also restarts when ready. The reboot command is simpler but offers fewer options for delays or cancellation.

When to use a delay instead of restarting when ready

Restarting when ready with /t 0 or "now" closes all open programs without saving. Use this only when you have already saved your work, or when your computer is so unresponsive that you have no other choice.

If you have unsaved documents or running programs, add a delay. On Windows, shutdown /r /t 300 gives you 5 minutes to save and close things. On Mac or Linux, sudo shutdown -r +5 does the same. You will see a countdown notification on your screen. When you are ready, you can cancel with shutdown /a or shutdown -c if you need more time.

Restarting a computer remotely using the command line

If you need to restart a different computer on your network, you can do this from the command line on your own computer. On Windows, use shutdown /r /m \\computername /t 0, replacing "computername" with the actual name of the computer you want to restart. You must have administrator rights on that computer for this to work.

On Mac or Linux, you can use SSH (find Shell) to connect to a remote computer and run the shutdown command there. Type ssh username@ipaddress, replacing username and ipaddress with the correct details. Once connected, type sudo shutdown -r now. This is more complex and requires that SSH is already set up on the remote computer — if you are not sure whether it is, ask your network administrator or the person who manages that computer.

Frequently Asked Questions

What if I type the command wrong?

The command line will display an error message saying the command was not recognized. straightforward type the correct command and press Enter again. There is no harm in typing it wrong — nothing happens until you press Enter.

Can I restart someone else's computer without their permission?

Technically, if you have access to their computer or network, you can. But you should not. Restarting someone else's computer without warning can cause them to lose unsaved work. Always ask first.

Will restarting from the command line damage my computer?

No. A restart from the command line is the same as restarting through the graphical menu — it just takes a different route. The only risk is losing unsaved work if you use /t 0 or "now" without saving first.

How do I know if the restart command worked?

On Windows, you will see a notification appear on your screen saying "You are about to be signed off" or "The system is shutting down". On Mac and Linux, the Terminal window may close or display a shutdown message. Your screen will go dark, and your computer will restart.

What is the difference between shutdown and restart?

Shutdown turns the computer off completely. Restart shuts it down and then turns it back on automatically. Use shutdown /s on Windows or sudo shutdown -h now on Mac and Linux if you want to turn the computer off without restarting.