How to shutdown CentOS via CLI

How to shutdown CentOS 7 via CLI

When it comes to shutting down CentOS from the CLI (Command Line Interface) aka the console or terminal, there are a few options of the same command, in our case what we want to do is to shut down the Virtual Machine right away, that means immediately, without any delay on the process, in that case we can use the following command.

shutdown -h now

Shutting down Centos 7 from the console

Shutting down our CentOS must me done using the root account or another account with “sudo” privileges.

Halt vs Power Off

On a Virtual Machine you can use either Poweroff or Halt, poweroff does exactly the same as Halt, the difference comes on a Physical computer because Poweroff will turns off the whole unit including LEDs and everything else, it sends an ACPI command to the board, also to the PSU, to cut the power for a complete shutdown.

shutdown -P now

Because we’re working with a Virtual Machine, the -h (halt) option is technically more suitable, but it’s really up to you.

How to reboot Centos 7 via CLI

As you can imagine there is also an option of the “shutdown” command which allow us to be able to reboot the system, that option is “-r”, this option and many other can be seen checking the man page of the command.

shutdown -r now

How to view the shutdown man page

It is always a good idea to take a look at the command man page, that is the first resource you’ll have to learn the multiple options available for each command and also to start playing around and get fimiliarized with the different ways and the different outputs you can get using each option.

Where to go now?

We don’t want to continue using the Oracle terminal because of its own limitations, what we want to do instead is to use one of the commonly used terminal emulators like Putty, Secure CRT and for some specific tasks we are going to rely on WinSCP.

The next step would be then knowing the IP Address that was assigned to our CentOS VM.