Linux Commands Examples

A great documentation place for Linux commands

reboot

, halt, poweroff reboot or stop the system


see also : halt - poweroff - shutdown - telinit - runlevel

Synopsis

reboot [OPTION]... [REBOOTCOMMAND]

halt [OPTION]...

poweroff [OPTION]...


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

Why Windows needs reboot a lot more than Linux?

This is because of the architecture.

The major reason for this behavior is that Linux doesn't lock executed files and libraries, which allows direct replacement of those files and does only require the applications to restart. For installations is the reason the package-management-systems, while in Windows every program installs all needed libraries (even if they're already installed, but when they are in use they are locked, which needs a restart to clear the situation) in Linux an application only references the needed packages which are installed once (and never again), reducing the overhead.

0
source

How to automatically boot from Linux distro to Windows?

I suggest reading this article by PC World on: Auto reboot and Switch Default OS on dual boot XP and Vista and here's an excellent article by HowToGeek on the same subject: Create Shortcuts to Quickly Reboot to the Alternate OS in a Vista/XP Dual-Boot

Update: You should be able to use the grub-set-default command to tell grub to boot into an alternate option just once.

Hope HowToGeek can help edit this post into something that switches between Linux and XP.

After reading quite a bit of the Microsoft BCD publicaton and doing some extensive research on .bat files and bootloaders I came up with this. The procedure below employs DOS, Bootloaders and a nifty little program called wizmo. At this point and time I have a shortcut on each of my desktops that once clicked upon automatically reboots the system to the other OS. This feature I couldn't live without as I am constantly using XP for work stuff and Vista for personal stuff. So, if you want a nifty auto reboot button that takes you to your other OS... READ ON. Dangerous and exciting walkthrough follows. IF this sounds like something your going to do, read this walkthrough a couple of times as making a mistake can be costly...see the last disclaimer below.

Disclaimer: Caution be very carefull, messing with your master boot record and bcd store is dangerous and could cause your system not to boot at all, thus leading to more pain and suffering, proceed with caution.

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

Why sudo is needed for rebooting in terminal but not from the GUI?

Its a safety feature.

When using the GUI, you are (typically) sitting in front of the computer you are working on. However, when using a terminal, you might be physically on one machine and remotely using another. You might have many terminal windows open to many different machines. What if you accidentally type reboot in the wrong one? That action could range from an inconvenience to a complete disaster.

By using sudo it forces you to use a password. If you type in the wrong password it gives you an error and hopefully you realize that you are in the wrong terminal. This is why its good practice to have a different root password on every server.

0
source

What is the correct way to prevent non-root users from issuing shutdowns or reboots

First, note that ConsoleKit's shutdown function considers "single user" and "multiple users" as two different situations – shutting down the system always requires administrator authentication if other users are logged in.


All such actions are managed by PolicyKit. If you want to adjust the policies, you can do so as described in polkit(8) – /etc/polkit-1/rules.d/20-disallow-shutdown.rules:

polkit.addRule(function(action, subject) {
    if ((action.id == "org.freedesktop.consolekit.system.stop" ||
         action.id == "org.freedesktop.consolekit.system.restart") &&
        subject.isInGroup("users")) {
            return subject.active ? polkit.Result.AUTH_ADMIN : polkit.Result.NO;
    }
});

PolicyKit 0.105 and earlier versions document this in pklocalauthority(8)/etc/polkit-1/localauthority/50-local.d/20-disallow-shutdown.pkla:

[Disallow shutdown]
Identity=unix-group:users
Action=org.freedesktop.consolekit.system.stop;org.freedesktop.consolekit.system.restart
ResultAny=no
ResultInactive=no
ResultActive=auth_admin

The Actions are listed in the ConsoleKit policy file or by running pkaction.

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

Ways to remotely reboot a Linux system

I guess there is no solutions for rebooting without having a harddisc connected or the necessary software loaded on ramdisk. If it's a virtual machine, reboot it on the hypervisor. Otherwise I hope you have a PDU / IPMI or similar.

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

whats the main difference between reboot and restart of a machine

It is indeed a terminology issue.

Reboot is more specific, and involves the computer reloading the boot loader on the boot drive. Some operating systems "reboot" by an ACPI command, which "restarts" the computer.

Restart is vague, and can mean the same as reboot, or a reload of the current operating system (without the boot loader), or even just restarting the user mode part of the operating system, leaving the kernel mode memory intact. It may also mean allowing the BIOS to reselect the boot drive and boot loader, which may require resetting the motherboard by way of an ACPI command.

description

These programs allow a system administrator to reboot, halt or poweroff the system.

When called with --force or when in runlevel 0 or 6, this tool invokes the reboot(2) system call itself (with REBOOTCOMMAND argument passed) and directly reboots the system. Otherwise this simply invokes the shutdown(8) tool with the appropriate arguments without passing REBOOTCOMMAND argument.

Before invoking reboot(2), a shutdown time record is first written to /var/log/wtmp

options

-f, --force

Does not invoke shutdown(8) and instead performs the actual action you would expect from the name.

-p, --poweroff

Instructs the halt command to instead behave as poweroff.

-w, --wtmp-only

Does not call shutdown(8) or the reboot(2) system call and instead only writes the shutdown record to /var/log/wtmp

--verbose

Outputs slightly more verbose messages when rebooting, useful for debugging problems with shutdown.

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

reboot 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 runlevel record being replaced by a shutdown time record.

/var/log/wtmp

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

reporting bugs

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


see also

shutdown telinit runlevel


author

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

How can this site be more helpful to YOU ?


give  feedback