Restart system in linux

Содержание
  1. Команда Reboot (перезагрузка) Linux
  2. Linux Reboot (Restart) Command
  3. В этом руководстве мы расскажем , как использовать systemctl и shutdown команды для перезагрузки машины Linux. Команды должны запускаться от имени пользователя root или пользователя с sudo привилегиями.
  4. С помощью systemctl
  5. С помощью shutdown
  6. Вывод
  7. 5 Linux Commands to Shutdown and Reboot the System
  8. Linux shutdown / reboot command
  9. 1. «shutdown» command
  10. 2. «reboot» command
  11. 3. «halt» command
  12. 4. «poweroff» command
  13. 5. REISUB — R E I S U B key strokes
  14. 10 thoughts on “ 5 Linux Commands to Shutdown and Reboot the System ”
  15. Reboot Linux System Command
  16. Linux system restart
  17. Reboot Linux system command
  18. How do I reboot remote Linux server?
  19. A note about systemctl command when using systemd
  20. Conclusion
  21. Restart system in linux
  22. Перезагрузка и выключение Linux из командной строки
  23. Перезагрузка Linux системы.
  24. 1. Команда shutdown, с ключом -r.
  25. 2. Команда reboot.
  26. 3. Команда telinit 7.
  27. Выключение Linux системы.
  28. 1. Команда shutdown, с ключом -h.
  29. 2. Команда halt.
  30. 3. Используем команду poweroff.
  31. 4. Команда telinit 0
  32. How to Restart or Reboot Linux Server from the Command Line
  33. Steps to Restart Linux using Command Prompt
  34. Restarting Local Linux Operating System
  35. Step 1: Open Terminal Window
  36. Step 2: Use the shutdown Command
  37. Alternative Option: Restart Linux with reboot Command
  38. Reboot Remote Linux Server
  39. Step 1: Open Command Prompt
  40. Step 2: Use SSH Connection Issue reboot Command

Команда Reboot (перезагрузка) Linux

Linux Reboot (Restart) Command

В этом руководстве мы расскажем , как использовать systemctl и shutdown команды для перезагрузки машины Linux. Команды должны запускаться от имени пользователя root или пользователя с sudo привилегиями.

Когда ядро ​​обновляется, если вы не используете Ksplice или KernelCare, вам необходимо перезагрузить систему Linux. Перезагрузка системы может также потребоваться в других обстоятельствах, например, при устранении неполадок оборудования, установке приложений и т. Д. Если вы используете безголовый сервер Linux, вам нужно знать, как перезагрузить систему из командной строки.

В большинстве современных дистрибутивов Linux systemctl утилита заменяет большинство команд управления питанием, использовавшихся в старых дистрибутивах Linux, на sysvinit. reboot И shutdown команды псевдонимы systemctl и доступны в системе по причинам совместимости.

С помощью systemctl

Чтобы перезагрузить систему Linux, просто введите reboot или systemctl reboot :

Система будет перезапущена немедленно.

Когда инициируется перезагрузка, все зарегистрированные пользователи и процессы уведомляются о том, что система выходит из строя, и дальнейшие входы в систему запрещены. Linux закроет все открытые файлы, остановит запущенные процессы и перезапустит систему.

Чтобы запретить команде reboot отправлять сообщение, выполните команду с —no-wall параметром:

Если вы хотите установить собственное сообщение, объясняющее причину перезагрузки, используйте —message= параметр:

Сообщение будет отображаться в журналах:

С помощью shutdown

При использовании с -r параметром shutdown команда выполняет перезагрузку системы:

По умолчанию система будет перезагружена через 1 минуту, но вы можете указать точное время, когда вы хотите, чтобы система была перезагружена.

Аргумент времени может иметь два разных формата. Это может быть абсолютное время в формате hh:mm и относительное время в формате, +m где m — это количество минут с этого момента.

В следующем примере будет запланирована перезагрузка системы на 10 часов утра:

В следующем примере будет запланирована перезагрузка системы через 5 минут:

Чтобы немедленно выключить вашу систему, используйте +0 ее псевдоним now :

Чтобы передать собственное сообщение вместе со стандартным уведомлением о завершении работы, введите свое сообщение после аргумента времени.

Следующая команда отключит систему через 10 минут и уведомит пользователей, что будет выполнено обновление оборудования:

Важно отметить, что при указании пользовательского настенного сообщения вы также должны указать аргумент времени.

Если вы запланировали перезагрузку и хотите отменить ее, запустите shutdown команду с -c параметром:

Вы также можете отправить сообщение, описывающее, почему перезагрузка была отменена:

Вывод

Для перезагрузки системы Linux введите reboot свой терминал. Операционная система перезагрузится через несколько секунд.

Источник

5 Linux Commands to Shutdown and Reboot the System

Linux shutdown / reboot command

On Linux, like all tasks, the shutdown and restart operations can also be done from the command line.

The commands are shutdown, halt, poweroff, reboot and REISUB keystrokes.

In this post I am going to show you how to shutdown or restart a linux system using these commands.

The commands are useful specially when you have to reboot a remote linux server, where only shell access is available and no gui.

Servers often need a restart when upgrades are installed or need to shutdown for other maintainance tasks.

The commands are available on any linux system like centos, ubuntu, debian, fedora or suse and do not require the installation of any extra packages.

Читайте также:  Windows 10 запуск приложений после перезагрузки

1. «shutdown» command

The first command is the shutdown command and it can be used to shutdown a system or restart it. It is commonly used to shutdown or reboot both local and remote machines.

To shutdown a machine call the shutdown command like this

The h option is for halt which means to stop. The second parameter is the time parameter. «now» means that shutdown the system right away.

The time parameter can be specified in minutes or hours also. For example

The above command shall flash the message to all other logged in users and give them 5 minutes before the system goes for shutdown.

The shutdown command can be used to restart a system with the r option instead of the h option. Usage is same as before. Just replace the h option with r option.

All other logged in users will see a broadcast message in their terminal like this

At this point a shutdown can be cancelled by calling shutdown with «c» option.

2. «reboot» command

Next command is the reboot command. It can be used to shutdown or reboot linux.

The following command will shutdown linux.

The «p» options stands for poweroff.

To reboot linux just call the reboot command directly without any options.

This will perform a graceful shutdown and restart of the machine. This is what happens when you click restart from your menu.

Reboot linux forcibly

The following command will forcefully reboot the machine. This is similar to pressing the power button of the CPU. No shutdown takes place. The system will reset instantly.

The man page explains it as follows

3. «halt» command

The next command is the halt command. This can shutdown a system

The halt command also has a force option, but you do not want to use it. It is supposed to shutdown the system instantly. But its behaviour may not be consistent. Desktops might hang on running this command.

4. «poweroff» command

There is another command exactly same as the halt command. It does the same things and takes the same options.

5. REISUB — R E I S U B key strokes

The above shown commands can be used when you are in control of your system. What if the system has hanged and is not responding at all. And you do not want to press the power button on the CPU which might lead to data corruption. To save from such a situation, comes the magic sysRQ keys.

A special combination of key presses that will allow you to reboot your linux system, no matter how much it is hanged. Check the wikipedia article. for more information.

Warning : Pressing the following keys would instantly reboot your system. Its similar to pressing the power button of your CPU or executing the reboot -f command.

Now in place of the B key we have to use R E I S U letters first. Each key does a task as mentioned below

1. Hold down the Alt and SysRq (Print Screen) keys.
2. While holding those down, type the following keys in order, several seconds apart: R E I S U B
3. Computer should reboot.

Make sure to have some time gap between each of keys R E I S U B.

The sysrq feature can be controlled by changing the value of /proc/sys/kernel/sysrq. To check if sysrq is enabled on the system or not, echo the value. It should be non zero.

A Tech Enthusiast, Blogger, Linux Fan and a Software Developer. Writes about Computer hardware, Linux and Open Source software and coding in Python, Php and Javascript. He can be reached at [email protected] .

10 thoughts on “ 5 Linux Commands to Shutdown and Reboot the System ”

It worked on SUSE SLES 11

Now systemctl utility replaces a number of power management commands and even the shutdown command will call systemctl utility to perform the shutdown tasks.

The command reboot does work and immediately rebooted my Bluestar Linux system 4.20.7 (based on Arch Linux).

I am so glad that you could reboot your linux system!

If I’m not mistaken, reboot by itself actually does a shutdown: https://linux.die.net/man/8/reboot . You have to do reboot -f to actually get it to reboot.

Arrrgh so sick of finding the incorrect example of shutdown everywhere. The reboot syntax shown, on Ubuntu and probably in every flavor today, will Immediately reboot your server with no delay or warning. the +5 option is either wrong or in the wrong spot.

Читайте также:  Final h encore mac os

Important note – this only applies (AFAIKT) to x86 systems. On arm – no-worky.

what? 20 – 30 mins? O.o Shouldn’t it be 20 – 30 seconds?

I rebooted my linux machine using command reboot -f, it went down. How long does it takes normally to start again?

Its depends upon hardware and file system mounted on Linux box , If it is high end hardware and have been mounted more file system then it will 20-30 mins to come online

Источник

Reboot Linux System Command

Linux system restart

Tutorial details
Difficulty level Easy
Root privileges Yes
Requirements Linux
Est. reading time 1m

To reboot Linux using the command line:

  1. To reboot the Linux system from a terminal session, sign in or “su”/”sudo” to the “root” account.
  2. Then type “ sudo reboot ” to reboot the box.
  3. Wait for some time and the Linux server will reboot itself

Reboot Linux system command

You must login as root user to reboot the system. Open the terminal application (or login to remote box using ssh client) and type any one of the following command to reboot the system immediately:
# /sbin/reboot
OR
# /sbin/shutdown -r now
You can also use sudo command under Ubuntu/Debian/Fedora and other Linux based distros:
$ sudo reboot
It is a good idea to provide notification to all logged-in users that the system is going down and, within the last five minutes of TIME, new logins are prevented. Type the following command:
# shutdown -r +5
Sample output:

TIME may have different formats, the most common is simply the word “ now ” which will bring the system down immediately. Other valid formats are +m, where m is the number of minutes to wait until shutting down and hh:mm which specifies the time on the 24hr clock.

How do I reboot remote Linux server?

Simply login as the root user using ssh command:
$ ssh root@remote-server-com /sbin/reboot
OR
$ ssh root@remote-server-com /sbin/shutdown -r now
Sample outputs:

  • No ads and tracking
  • In-depth guides for developers and sysadmins at Opensourceflare✨
  • Join my Patreon to support independent content creators and start reading latest guides:
    • How to set up Redis sentinel cluster on Ubuntu or Debian Linux
    • How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
    • How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
    • A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
    • How to protect Linux against rogue USB devices using USBGuard

Join Patreon

Get notification using the ping command when remote-server-com comes online:
ping -a remote-server-com
It is possible to use sudo command along with normal user over ssh session too. The syntax is:
$ ssh -t vivek@remote-server-com /sbin/reboot
Without the -t you will seen an error “sudo: no tty present and no askpass program specified“, hence you must pass the -t to the ssh command.

A note about systemctl command when using systemd

Are you using systemd as init on your Linux distro? Most modern Linux distro such as Debian, Ubuntu, CentOS, RHEL, Fedora, Arch, and many uses systemd, and we can use the following command to reboot the system:
sudo systemctl reboot

Conclusion

This page demonstrated how to use reboot command on Linux to reboot the server or desktop for software and kernel updates.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via

Источник

Restart system in linux

Перезагрузка и выключение Linux из командной строки

Иногда требуется удаленно перезагрузить или выключить операционную систему под управлением Linux из командной строки. Сделать это можно различными способами, их то мы и рассмотрим.

Замечание. Все ниже перечисленные команды надо выполнять из под пользователя root.

Для смены пользователя или получения прав root используйте команды «su -» или «sudo».

Перезагрузка Linux системы.

1. Команда shutdown, с ключом -r.

Команда shutdown является основной командой для управлением остановки или перезагрузки системы linux.

При использование команды shutdown можно задать перезагрузку в конкретное время с выводом информирующих сообщений.

2. Команда reboot.

Команда reboot выпоняет все необходимые операции для остановки системы, эта команда может быть вызвана командой shutdown -r, но может использоваться отдельно. Данная команда записывает в журнал логов время остановки системы, уничтожает незавершенные процессы, выполняет системный вызов sync, ждет завершения записи на диск, а только после этого прекращает работу ядра и перезагружает систему Linux.

3. Команда telinit 7.

С помощю этой команды можно задать демону init перейти на определенный уровень выполнения, а именно цифра 7 говорит о том что нужно прейти на 7-ой уровеь (перезагрузка). Команда telinit не поддерживает задание паузы и вывода предупреждающих сообщений. Обычно используется при проверке изменений внесеных в файл inittab.

Выключение Linux системы.

1. Команда shutdown, с ключом -h.

2. Команда halt.

Команда идентична команде reboot по своим действиям, разница в том, что команда halt выключает систему.

3. Используем команду poweroff.

Команда poweroff идентична команде halt, кроме того, что после остановки системы посылается специальный запрос системе управления питанием на отключение питания, что позволяет дистанционно отключать системы.

4. Команда telinit 0

Идентична команде telinit 7 только переходит на уровень 0, что означает остановку системы.

Вот и все, рассмотрение основных способов выключение и перезагрузки Linux систем из командной строки завершено.

1″ :pagination=»pagination» :callback=»loadData» :options=»paginationOptions»>

Источник

How to Restart or Reboot Linux Server from the Command Line

Home » SysAdmin » How to Restart or Reboot Linux Server from the Command Line

It’s a cliché, but true – restarting a Linux server solves a wide variety of issues.

When a system is rebooted, any malfunctioning software is purged from active memory. When the system restarts, it loads a fresh, clean copy of the software into active memory. Also, some operating systems require a restart to process updates or configuration changes.

This guide will show you how to restart a Linux server using only the command-line or prompt.

  • A system running a Linux operating system
  • Access to a command-line interface (also known as a terminal)
  • Root or sudo privileges
  • (optional) SSH software package for communicating with a remote server

Steps to Restart Linux using Command Prompt

Restarting Local Linux Operating System

Step 1: Open Terminal Window

If your version of Linux uses a graphical interface, you can open a terminal window by right-clicking the Desktop > left-clicking Open in terminal.

You can also click the main menu (usually found in the lower-left or upper-left corner) and type in terminal in the search bar. Click on the Terminal icon, as in the image below.

Step 2: Use the shutdown Command

Since powering off is one of the most basic functions of an operating system, this command should work for most distributions of Linux.

In a terminal window, type the following:

The sudo command tells Linux to run the command as an administrator, so you may need to type your password. The –r switch at the end indicates that you want the machine to restart.

Note: See our article for additional Linux shutdown command options.

Alternative Option: Restart Linux with reboot Command

In the terminal, type:

Many Linux versions do not require administrator privileges to reboot. If you get a message that you do not have sufficient privileges, type:

Your system should close out of all open applications and restart.

Reboot Remote Linux Server

Step 1: Open Command Prompt

If you have a graphical interface, open the terminal by right-clicking the Desktop > left-clicking Open in terminal.

You can also click the main menu (usually found in the lower-left or upper-left corner), and then click Applications > System Tools > Terminal.

If you prefer using a keyboard shortcut, press Ctrl+Alt+T.

Step 2: Use SSH Connection Issue reboot Command

In a terminal window, type:

Note: You may need to enter the password for the username you’ve used. Also, make sure you type the single-quote marks.

The ssh command tells your system to connect to another machine. The –t option forces the remote system to enter the command in a terminal. Replace user@server.com with the username @ server name that you want to restart.

The sudo reboot command can be switched out for sudo shutdown and the above options above can be used.

That is: -r tells it to restart, hh:mm sets a specific time, +mm sets a countdown.)

In this tutorial, you have learned how to restart a Linux server from the command prompt.

Rebooting a Linux system or server is designed to be simple, so you shouldn’t have any trouble. Just make sure you have saved all your work before restarting.

Источник

Читайте также:  Список переменных сред windows
Оцените статью