By default, Ubuntu is configured to always prompt you with a confirmation dialog box with two choices when you want to shut down or restart your computer. The same thing happens when you log out of your account or lock your session.
The confirmation dialog box for restart/shutdown is a safeguard meant to prevent you from accidentally shutting down or restarting your computer. If you’re in a hurry, however, you may tell Ubuntu to shut down and walk away, forgetting about the confirmation dialog box and leaving the computer on. If you would rather not be bothered with the confirmation dialog box when shutting down or restarting your computer, you can turn this dialog box off.
NOTE: Turning off the Shut Down/Restart confirmation dialog box also turns off the Log Out/Lock confirmation dialog box.
Notice that when the confirmation dialog box is enabled, there is no Restart option on the system menu. When you choose Shut Down, the Restart option is on the same confirmation dialog box.
To disable the Shut Down/Restart confirmation dialog box, press Ctrl + Alt + T to open a Terminal window. Type the following command at the prompt and press Enter.
gsettings set com.canonical.indicator.session suppress-logout-restart-shutdown true
Click the X button in the upper-left corner of the Terminal window to close it.
You do not need to log out or restart for this change to take effect. Notice that the Restart option is not available on the System menu. When you select Shut Down, Restart, Log Out, or Lock, the action now happens immediately without confirmation.
To turn on the confirmation dialog box again, open a Terminal window again, type the following command at the prompt and press Enter.
gsettings set com.canonical.indicator.session suppress-logout-restart-shutdown false
Now, you can quickly shut down or restart your Ubuntu computer. However, be careful not to accidentally shut it down without intending to do so.