fbpx shutdown and halt Commands in Linux: Shutdown and Restart | Certificação Linux

shutdown Command in Linux: How to Shutdown, Restart and Schedule

📅 01/01/2019 ⏱ 2 min ✍️ Uira Ribeiro
Linuxcommands
shutdown Command in Linux: How to Shutdown, Restart and Schedule
Exam Pass App — mais de 7.000 questões LPI, offline, em 5 idiomas, disponível no Android e na App Store
Available on
Google Play
Available on
App Store

The shutdown command in Linux is used to shut down or restart the system at scheduled times. During this procedure, it disables the login system to prevent new users from logging in and sends customized messages to all connected users' terminals warning that the system will be shut down.

The most frequent options are:

  • -r  Restarts (reboots) the system after the shutdown sequence completes;
  • -h  Halts the system after the shutdown sequence completes. Does not restart the machine;
  • -k  Sends the shutdown message but does not initiate the shutdown sequence;
  • -f   Performs a fast system boot without disk check;
  • -F  Forces a disk check when the system restarts.

To restart the system immediately:

# shutdown –r now

To restart the system at 06:00 AM and send a message to users' terminals:

# shutdown –r 06:00 “Haverá troca de hardware”

The difference between changing the runlevel to 0 or 6 and the shutdown command is that shutdown is administratively better because it notifies users that there will be a system shutdown. With init change there is no type of warning.

Control-Alt-Del

The "ca" line in the /etc/inittab file handles what happens when we press the control+alt+del sequence:

ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now

And before taking any maintenance or system restart action, especially when dealing with a multi-user server, it is best practice for the administrator to use the wall utility to send messages to logged-in users.

Learn much more about Linux in our online course. You can enroll here. If you already have an account, or want to create one, just log in or create your user here.

Liked it? Share

Uira Ribeiro

Prof. Uirá Ribeiro

Chair do Board do Linux Professional Institute

After years of watching professionals waste hours on simple tasks because they didn't know the right Linux tools, I decided to teach.
Today I'm the author of most of LPI's official Learning Materials and mentor to over 14,000 certified students.

See my full story →

That was just one piece. The course teaches the whole path — from your first command to exam day.

Certificação Linux — a plataforma líder em certificações Linux no Brasil
WhatsApp