There are several ways to shut down a Linux server, depending on the type of system you are using. Here are a few common methods:
- Using the
shutdown
command: This command can be used to shut down a system at a specified time or after a specified delay. For example, to shut down the system immediately, you can use the commandshutdown -h now
. - Using the
init
command: Theinit
command can be used to change the runlevel of the system, which controls what services and processes are running. To shut down the system, you can use the commandinit 0
. - Using the
poweroff
command: This command is used to immediately power off the system. This command works on most systems, including HP, IBM, Sun, and Dell servers. - Using the
reboot
command: This command is used to reboot the system. It is similar to the poweroff command, but it restarts the system instead of shutting it down.
It is important to note that these commands will only work if you have the proper permissions. If you are logged in as a regular user, you will need to use sudo
to execute the command with root privileges.
Also, in some systems, the command systemctl poweroff
or systemctl reboot
could also work.