Linux Commands Examples

A great documentation place for Linux commands

shutdown

bring the system down


see also : runlevel - init - telinit - reboot

Synopsis

shutdown [OPTION]... TIME [MESSAGE]


add an example, a script, a trick and tips

: email address (won't be displayed)
: name

Step 2

Thanks for this example ! - It will be moderated and published shortly.

Feel free to post other examples
Oops ! There is a tiny cockup. A damn 404 cockup. Please contact the loosy team who maintains and develops this wonderful site by clicking in the mighty feedback button on the side of the page. Say what happened. Thanks!

examples

0
source
            
shutdown -h now
0
source
            
gksudo "shutdown -h now"
0
source
            
sudo shutdown -r
0
source
            
sudo shutdown -h
0
source
            
sudo shutdown -h 0
0
source
            
xm shutdown wxp64
0
source

Poweroff , damages hardware?

poweroff is the proper way to do this. shutdown -h is exactly equivalent in Debian/Ubuntu (and most other systems).

0
source

Ubuntu shutdown fail "* Killing all remaining processes..."

I've experienced the same, so I had to use halt which worked

shutdown -h now

0
source

Does shutdown/reboot need root privileges under Linux?

Imagine your computer is a shared webhosting server, where every user is granted SSH access. There are about 500 users per one server in such setup.

Should anyone really be allowed to reboot the entire server, disrupt HTTP downloads, break SSH sessions, etc?

0
source

My computer reboots when I tell it to shutdown

I have had cases where even though the BIOS is set to not wake for anything, it still does (especially hard wired NIC - PSU based machines).

Try unplugging your Ethernet Cable, and then shutdown. This will show if it is any sort of "magic packet" that is being sent, even without your knowledge.

0
source

Shutdown Ubuntu Command

It uses a DBus message.

dbus-send --system --print-reply --dest=org.freedesktop.Hal \
          /org/freedesktop/Hal/devices/computer \
          org.freedesktop.Hal.Device.SystemPowerManagement.Shutdown

Found this here.

Reboot:

dbus-send --system --print-reply --dest=org.freedesktop.Hal \
          /org/freedesktop/Hal/devices/computer \
          org.freedesktop.Hal.Device.SystemPowerManagement.Reboot

Suspend:

dbus-send --system --print-reply --dest=org.freedesktop.Hal \
          /org/freedesktop/Hal/devices/computer \
          org.freedesktop.Hal.Device.SystemPowerManagement.Suspend int32:1

Hibernate:

dbus-send --system --print-reply --dest=org.freedesktop.Hal \
          /org/freedesktop/Hal/devices/computer \
          org.freedesktop.Hal.Device.SystemPowerManagement.Hibernate

0
source

How to shutdown instantly?

sudo shutdown -h now

0
source

What is the difference between the shutdown, halt and reboot commands?

halt brings the system down to its lowest state, but leaves it powered on.

shutdown brings the system down to its lowest state, and will turn off power (soft power switch) if it can. Most computers now can do so.

reboot restarts the system. It brings the system down to its lowest state, then starts it up again.

Which to do depends on what you want to do. halt is usually to get to a state where you can perform low level maintenance. shutdown is to power the system off, and reboot is to reboot it.

0
source

How to shut down a computer having a particular IP address?

Windows has the shutdown /m \\computername command built in, but for Linux you probably would have to install ssh and use ssh root@computername /sbin/shutdown. Why wouldn't a Linux box have SSH installed, anyway?

0
source

What is the proper way to enable a normal user to shutdown, halt or reboot the computer?

All users? Or a selected subset of them? Will they use the computer locally or also remotely (e.g. via ssh).

In case of a few users who also work remotely sudo will work fine. See this link for details.

If they are logging in locally and via a GUI then there are better options. E.g. capturing the three finger salute via init and letting that trigger a 1 minute delayed shutdown. It has been ages since I set that up though, so I skipping on the details for that. (I used that back when Slackware 3 was modern)

0
source

How can I catch or stop a Linux shut down from the terminal?

sudo shutdown -c

This will cancel a scheduled shutdown. You don't have to run it in the same terminal as the original shutdown request.

description

shutdown arranges for the system to be brought down in a safe way. All logged-in users are notified that the system is going down and, within the last five minutes of TIME, new logins are prevented.

TIME may have different formats, the most common is simply the word ’now’ which will bring the system down immediately. Other valid formats are +m, where m is the number of minutes to wait until shutting down and hh:mm which specifies the time on the 24hr clock.

Once TIME has elapsed, shutdown sends a request to the init(8) daemon to bring the system down into the appropriate runlevel.

This is performed by emitting the runlevel(7) event, which includes the new runlevel in the RUNLEVEL environment variable as well as the previous runlevel (obtained from the environment or from /var/run/utmp) in the PREVLEVEL variable. An additional INIT_HALT variable may be set, this will contain the value HALT when bringing the system down for halt and POWEROFF when bringing the system down for power off.

options

-r

Requests that the system be rebooted after it has been brought down.

-h

Requests that the system be either halted or powered off after it has been brought down, with the choice as to which left up to the system.

-H

Requests that the system be halted after it has been brought down.

-P

Requests that the system be powered off after it has been brought down.

-c

Cancels a running shutdown. TIME is not specified with this option, the first argument is MESSAGE.

-k

Only send out the warning messages and disable logins, do not actually bring the system down.

copyright

Copyright © 2009 Canonical Ltd.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

environment

RUNLEVEL

shutdown will read the current runlevel from this environment variable if set in preference to reading from /var/run/utmp

files

/var/run/utmp

Where the current runlevel will be read from; this file will also be updated with the new runlevel.

/var/log/wtmp

A new runlevel record will be appended to this file for the new runlevel.

notes

The Upstart init(8) daemon does not keep track of runlevels itself, instead they are implemented entirely by its userspace tools.

See runlevel(7) for more details.

reporting bugs

Report bugs at <https://launchpad.net/upstart/+bugs>


see also

runlevel init telinit reboot


author

Written by Scott James Remnant <scott[:at:]netsplit[:dot:]com>

How can this site be more helpful to YOU ?


give  feedback