The process of shutting down the system involves the orderly termination of all the processes on the system, as well as performing some vital housekeeping chores (such as syncing all of the mounted file systems) before the system powers off. Four commands can perform this function:
- halt
- poweroff
- reboot
- shutdown
halt command turns off the computer. Insert anote in the file /var/log/wtmp; if the system is in runlevel 0 or 6, stop all processes; otherwise, call shutdown -h.
halt Command Examples
1. To stop the machine:
# halt
2. To not to sync before poweroff:
# halt --no-sync
3. To force stop the machine:
# halt -f # halt --force
4. To poweroff the machine:
# halt -p # halt --poweroff
5. Don’t reboot but write the wtmp record:
# halt -w # halt --wtmp-only
6. To set the verbose mode:
# halt --verbose
7. To show the errors only in output:
# halt -q # halt --quiet
8. Suppress writing to /var/log/wtmp.
# halt -d
9. No sync before reboot or halt:
# halt -n
10. Shut down network interfaces before halt.
# shutdown -i
11. Place hard drives in standby mode before halt or power off.
# shutdown -h
9. To display the help:
# halt --help
Configuration Files
/var/run/utmp: Reads current runlevel from.
/var/log/wtmp: A new runlevel record for the shutdown time will be appended to this file.