DebianThis forum is for the discussion of Debian Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
The 'man' command provides documentation on various commands. From 'man halt':
Quote:
When called with --force or when in runlevel 0 or 6, this tool invokes the reboot(2) system call itself and directly reboots the system. Otherwise this simply invokes the shutdown(8) tool with the appropriate arguments.
shutdown - bring the system downshutdown brings the system down in a secure way. All logged-in users
are notified that the system is going down, and login(1) is blocked.
It is possible to shut the system down immediately or after a specified
delay. All processes are first notified that the system is going down
by the signal SIGTERM. This gives programs like vi(1) the time to save
the file being edited, mail and news processing programs a chance to
exit cleanly, etc. shutdown does its job by signalling the init
process, asking it to change the runlevel. Runlevel 0 is used to halt
the system, runlevel 6 is used to reboot the system, and runlevel 1 is
used to put to system into a state where administrative tasks can be
performed; this is the default if neither the -h or -r flag is given to
shutdown. To see which actions are taken on halt or reboot see the
appropriate entries for these runlevels in the file /etc/inittab.
/sbin/shutdown [-akrhPHfFnc] [-t sec] time [warning message]
Code:
halt, reboot, poweroff - stop the system.
Halt notes that the system is being brought down in the file
/var/log/wtmp, and then either tells the kernel to halt, reboot or
power-off the system.
If halt or reboot is called when the system is not in runlevel 0 or 6,
in other words when it's running normally, shutdown will be invoked
instead (with the -h or -r flag). For more info see the shutdown(8)
manpage.
The rest of this manpage describes the behaviour in runlevels 0 and 6,
that is when the systems shutdown scripts are being run.
/sbin/halt [-n] [-w] [-d] [-f] [-i] [-p] [-h]
/sbin/reboot [-n] [-w] [-d] [-f] [-i]
/sbin/poweroff [-n] [-w] [-d] [-f] [-i] [-h]
It seems to be not so much difference between shutdown and halt command.
Shutdown allows for a time factor and a warning message to other users on the system. Halt is LIGHTS OUT with no warning.
If you're the only user on your system, either will be fine. You must be root to execute these commands, though. You can also use telinit 0, which tells the system to go into run level 0 (halt, off, power down).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.