Home » What is the difference between these commands for bringing down a Linux server?

What is the difference between these commands for bringing down a Linux server?


And now, the systemd answer.

You’re using, per the tag on your question, Red Hat Enterprise Linux. Since version 7, that has used systemd. None of the other answers are correct for the world of systemd; nor even are some of the assumptions in your question.

  • Forget about runlevels; they exist, but only as compatibility shims. The systemd documentation states that the concept is “obsolete”. If you’re starting to learn this stuff on a systemd operating system, don’t start there.
  • Forget about the manual page that marcelm quoted; it’s not from the right toolset at all, and is a description of another toolset’s command, incorrect for systemd’s. It’s the one for the halt command from the van Smoorenburg “System 5” init utilities.
  • Ignore the statements that /sbin/halt is a symbolic link to /sbin/reboot; that’s not true with systemd. There is no separate reboot program at all.
  • Ignore the statements that halt or reboot invoke a shutdown program with command-line arguments; they are also not true with systemd. There is no separate shutdown program at all.

Every system management toolset has its version of these utilities. systemd, upstart, nosh, van Smoorenburg init, and BSD init all have their own halt, poweroff, and so forth. On each their mechanics are slightly different. So are their manual pages.

In the systemd toolset halt,poweroff,reboot, telinit, and shutdown are all symbolic links to /bin/systemctl. They are all backwards compatibility shims, that are simply shorthands for invoking systemd’s primary command-line interface: systemctl. They all map to (and in fact are) that same single program. (By convention, the shell tells it which name it has been invoked by.)

targets, not runlevels

Most of those commands are shorthands for telling systemd, using systemctl, to isolate a particular target. Isolation is explained in the systemctl manual page (q.v.), but can be, for the purposes of this answer, thought of as starting a target and stopping any others. The standard targets used in systemd are listed on the systemd.special(8) manual page.

The diagrams on the bootup(7) manual page in the systemd toolset, in particular the last one, show that there are three “final” targets that are relevant here:

  • halt.target — Once the system has reached the state of fully isolating this target, it will have called the reboot(RB_HALT_SYSTEM) system call. The kernel will have attempted to enter a ROM monitor program, or simply halted the CPU (using whatever mechanism is appropriate for doing so).
  • reboot.target — Once the system has reached the state of fully isolating this target, it will have called the reboot(RB_AUTOBOOT) system call (or the equivalent with the magic command line). The kernel will have attempted to trigger a reboot.
  • poweroff.target — Once the system has reached the state of fully isolating this target, it will have called the reboot(RB_POWER_OFF) system call. The kernel will have attempted to remove power from the system, if possible.

These are the things that you should be thinking about as the final system states, not run levels. Notice from the diagram that the systemd target system itself encodes things that are, in other systems, implicit rather than explicit: such as the notion that each of these final targets encompasses the shutdown.target target, so that one describes services that must be stopped before shutdown by having them conflict with the shutdown.target target.

systemctl tries to send requests to systemd-logind when the calling user is not the superuser. It also passes delayed shutdowns over to systemd-shutdownd. And some shorthands trigger wall notifications. Those complexities aside, which would make this answer several times longer, assuming that you are currently the superuser and not requesting a scheduled action:

  • systemctl isolate halt.target has the shorthands:
    • shutdown -H now
    • systemctl halt
    • plain unadorned halt
  • systemctl isolate reboot.target has the shorthands:
    • shutdown -r now
    • telinit 6
    • systemctl reboot
    • plain unadorned reboot
  • systemctl isolate poweroff.target has the shorthands:
    • shutdown -P now
    • telinit 0
    • shutdown now
    • systemctl poweroff
    • plain unadorned poweroff
  • systemctl isolate rescue.target has the shorthands:
    • telinit 1
    • systemctl rescue
  • systemctl isolate multi-user.target has the shorthands:
    • telinit 2
    • telinit 3
    • telinit 4
  • systemctl isolate graphical.target has the shorthand:
    • telinit 5

After parsing the various differing command-line syntaxes, these all eventually end up in the same code paths inside the systemctl program.


  • The traditional behaviour of option-less shutdown now has been to switch to single-user mode. This is not the case with systemd. rescue.target — single-user mode being renamed rescue mode in systemd — is not reachable with the shutdown command.
  • telinit really does wholly ignore all of those runlevelN.target and default.target symbolic links in the filesystem that the manual pages describe. The aforegiven mappings are hardwired into the systemctl program, in a table.
  • systemd has no notion of a current run level. The operation of these commands is not conditional upon any “if you are in run-level N“.
  • The --force option to the halt, reboot, and poweroff commands is the same as saying --force --force to the systemctl halt, systemctl reboot, and systemctl poweroff commands. This makes systemctl try to call reboot() directly. Normally it just tries to isolate targets.
  • telinit is not the same as init. They are different programs in the systemd world, the latter being another name for the systemd program, not for the systemctl program. The systemd program is not necessarily compiled with any van Smoorenburg compatibility at all, and on some systemd operating systems complains about being invoked incorrectly if one attempts init N.

Further reading

  • Are there any good reasons for halting system without cutting power?
  • Why does `init 0` result in “Excess Arguments” on Arch install?
  • Stephen Wadeley (2014). “8. Managing Services with systemd” Red Hat Enterprise Linux 7 System Administrators’ Guide. Red Hat.
  • Lennart Poettering (2013-10-07). systemctl. systemd manual pages. freedesktop.org.
  • Lennart Poettering (2013-10-07). systemd.special. systemd manual pages. freedesktop.org.
  • Lennart Poettering (2013-10-07). bootup. systemd manual pages. freedesktop.org.
  • Jonathan de Boyne Pollard (2018). init. nosh Guide. Softwares.

  • halt instructs the hardware to stop all CPU functions, but leaves it in a powered-on state. This usually means someone has to reboot or shut the machine down manually by pressing the power button afterwards. The specific way to achieve this is architecture specific, but for instance the x86 instruction set provides the HLT instructions which halts the central processing unit (CPU) until the next external interrupt is fired.

  • poweroff, like halt, stops the CPU but also sends an ACPI hardware signal which will instruct the system to commence with a complete and immediate shutdown. This is roughly equivalent to pressing the power button on a typical desktop computer.

Both halt and poweroff are usually symbolic links to the reboot executable, which will usually invoke the shutdown tool with the appropriate arguments (-h, -P or r) depending on if halt, poweroff or reboot was used to invoke the tool. However, When the --force option is passed to reboot, or when in runlevel 0 or 6, reboot will invoke the reboot() system call with an appropriate command code itself.

halt, poweroff and shutdown -h are completely equivalent. In fact, halt and poweroff do nothing but call shutdown -h. From the halt/poweroff manpage:

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.

Shutdown then proceeds to shut down the system by switching to runlevel 0.

Halt and poweroff (and reboot) perform a dual role; when executed in the process of shutting down (i.e., in runlevel 0 or 6), they perform the low-level operations required to physically stop, power off, or reboot the machine, as described in another answer.

Related Solutions

Joining bash arguments into single string with spaces

[*] I believe that this does what you want. It will put all the arguments in one string, separated by spaces, with single quotes around all: str="'$*'" $* produces all the scripts arguments separated by the first character of $IFS which, by default, is a space....

AddTransient, AddScoped and AddSingleton Services Differences

TL;DR Transient objects are always different; a new instance is provided to every controller and every service. Scoped objects are the same within a request, but different across different requests. Singleton objects are the same for every object and every...

How to download package not install it with apt-get command?

Use --download-only: sudo apt-get install --download-only pppoe This will download pppoe and any dependencies you need, and place them in /var/cache/apt/archives. That way a subsequent apt-get install pppoe will be able to complete without any extra downloads....

What defines the maximum size for a command single argument?

Answers Definitely not a bug. The parameter which defines the maximum size for one argument is MAX_ARG_STRLEN. There is no documentation for this parameter other than the comments in binfmts.h: /* * These are the maximum length and maximum number of strings...

Bulk rename, change prefix

I'd say the simplest it to just use the rename command which is common on many Linux distributions. There are two common versions of this command so check its man page to find which one you have: ## rename from Perl (common in Debian systems -- Ubuntu, Mint,...

Output from ls has newlines but displays on a single line. Why?

When you pipe the output, ls acts differently. This fact is hidden away in the info documentation: If standard output is a terminal, the output is in columns (sorted vertically) and control characters are output as question marks; otherwise, the output is...

mv: Move file only if destination does not exist

mv -vn file1 file2. This command will do what you want. You can skip -v if you want. -v makes it verbose - mv will tell you that it moved file if it moves it(useful, since there is possibility that file will not be moved) -n moves only if file2 does not exist....

Is it possible to store and query JSON in SQLite?

SQLite 3.9 introduced a new extension (JSON1) that allows you to easily work with JSON data . Also, it introduced support for indexes on expressions, which (in my understanding) should allow you to define indexes on your JSON data as well. PostgreSQL has some...

Combining tail && journalctl

You could use: journalctl -u service-name -f -f, --follow Show only the most recent journal entries, and continuously print new entries as they are appended to the journal. Here I've added "service-name" to distinguish this answer from others; you substitute...

how can shellshock be exploited over SSH?

One example where this can be exploited is on servers with an authorized_keys forced command. When adding an entry to ~/.ssh/authorized_keys, you can prefix the line with command="foo" to force foo to be run any time that ssh public key is used. With this...

Why doesn’t the tilde (~) expand inside double quotes?

The reason, because inside double quotes, tilde ~ has no special meaning, it's treated as literal. POSIX defines Double-Quotes as: Enclosing characters in double-quotes ( "" ) shall preserve the literal value of all characters within the double-quotes, with the...

What is GNU Info for?

GNU Info was designed to offer documentation that was comprehensive, hyperlinked, and possible to output to multiple formats. Man pages were available, and they were great at providing printed output. However, they were designed such that each man page had a...

Set systemd service to execute after fstab mount

a CIFS network location is mounted via /etc/fstab to /mnt/ on boot-up. No, it is not. Get this right, and the rest falls into place naturally. The mount is handled by a (generated) systemd mount unit that will be named something like mnt-wibble.mount. You can...

Merge two video clips into one, placing them next to each other

To be honest, using the accepted answer resulted in a lot of dropped frames for me. However, using the hstack filter_complex produced perfectly fluid output: ffmpeg -i left.mp4 -i right.mp4 -filter_complex hstack output.mp4 ffmpeg -i input1.mp4 -i input2.mp4...

How portable are /dev/stdin, /dev/stdout and /dev/stderr?

It's been available on Linux back into its prehistory. It is not POSIX, although many actual shells (including AT&T ksh and bash) will simulate it if it's not present in the OS; note that this simulation only works at the shell level (i.e. redirection or...

How can I increase the number of inodes in an ext4 filesystem?

It seems that you have a lot more files than normal expectation. I don't know whether there is a solution to change the inode table size dynamically. I'm afraid that you need to back-up your data, and create new filesystem, and restore your data. To create new...

Why doesn’t cp have a progress bar like wget?

The tradition in unix tools is to display messages only if something goes wrong. I think this is both for design and practical reasons. The design is intended to make it obvious when something goes wrong: you get an error message, and it's not drowned in...