Wednesday, February 27, 2013

Tip: Shutdown commands in Linux and Windows

Have you ever been working in a command-line interface wondering how to shutdown or restart? This is not so much a problem per se as it is a list of shutdown/restart commands which may come in handy one day.

Linux/Ubuntu
To shutdown and completely power off right now, you can type at the prompt:

sudo shutdown -h now    OR   sudo shutdown -h 0

To reboot, type at the prompt:

sudo reboot   OR   sudo shutdown -r 0

(Note that the second command means to shutdown and then restart in zero seconds.  The -r flag means to restart.)

Windows
(This came in handy one day when a Windows computer I was trying to revive was so messed up I could only access the command line and not even the safe mode.)

Just type at the command prompt:

shutdown -s   OR  shutdown -s -t 0

In the above examples, the -s flag means to shut down the computer while the -t flag gives the time before shutting down (in the second case, in zero seconds).

More sources
[1] http://www.cyberciti.biz/faq/shutdown-ubuntu-linux-computer/
[2] http://samanathon.com/windows-tip-shutdown-your-computer-with-the-command-prompt/

0 comments:

Post a Comment