On Ubuntu, the following command can be used to shut down the computer:
-
shutdown
Ordersudo shutdown -h now
This command shuts down the system immediately.
-h
The option to have the system power off after shutdownnow
means to do it immediately.You can also set the system to shut down at a certain time, for example after 10 minutes:
sudo shutdown -h +10
-
poweroff
Ordersudo poweroff
This command also shuts down the system immediately.
-
halt
Ordersudo halt
This command stops all CPU functions, but does not turn off the power on some systems.
-
init
Ordersudo init 0
init
command is used to change the runlevel, where0
is the runlevel used for shutdown.
Note that these commands require administrator privileges to execute, so we prepend them sudo
.
Before performing any system shutdown commands, it is recommended to save all open files and close all running applications to prevent data loss.