Linux · 1月 19, 2023 0

How to Use the Commands to Reboot Your Linux System

内容纲要

Rebooting is the go-to option that many of us rely on whenever .

Linux offers the reboot command to restart or reboot a system.

Linux has got you covered in all these situations.

Let us look at the various commands available with Linux.

The Linux reboot command

Reboot command fits best for your local computer and remote systems.

General syntax:

sudo reboot [options]

Note: Make sure you use ‘sudo‘ when using the command prompt.

Using reboot command on your system

To start using the reboot command, take a look at the following example.

Syntax:

sudo reboot

Output:

After the restart command, all users will be informed that the system is being restarted.

After the reboot command is issued, no further user-logins will .

You can also use the following command to turn on your system.

/sbin/reboot

Using reboot command on a remote Linux system

Here I have used the sshutility to log in into the remote server.In the same command, I have specified to reboot the server using the /sbin/ .

General syntax:

ssh root@[remote_server_ip] /sbin/reboot

Customizing your reboot

If you’re a system admin, you can even drop a message (with the –message option) along with the reboot command.

Example:

sudo systemctl --message="Quarterly software maintenance drill" reboot

Here, we have used the systemctl command-line utility.You can use the service command instead of system.

Sample output:

System is rebooting (Quarterly software maintenance drill)

Checking reboot logs

The system reboot log is stored on your Linux machine.Instead of scroll through that file, you can use the last prompt to quickly check your log.

last reboot | less

output:

reboot   system boot  4.15.0-112-gener Tue Sep 29 16:30   still running
reboot   system boot  4.15.0-112-gener Tue Sep 29 13:21 - 16:30  (03:09)
reboot   system boot  4.15.0-112-gener Tue Sep 29 12:07 - 13:21  (01:13)
reboot   system boot  4.15.0-112-gener Tue Sep 29 08:51 - 12:06  (03:15)
reboot   system boot  4.15.0-112-gener Mon Sep 28 20:22 - 21:00  (00:37)
reboot   system boot  4.15.0-112-gener Mon Sep 28 16:27 - 16:45  (00:17)
reboot   system boot  4.15.0-112-gener Mon Sep 28 11:22 - 14:16  (02:54)
reboot   system boot  4.15.0-112-gener Sun Sep 27 23:04 - 00:22  (01:18)
reboot   system boot  4.15.0-112-gener Sun Sep 27 11:25 - 12:29  (01:03)
reboot   system boot  4.15.0-112-gener Sat Sep 26 09:52 - 12:15  (02:23)
reboot   system boot  4.15.0-112-gener Fri Sep 25 11:12 - 12:15 (1+01:03)
reboot   system boot  4.15.0-112-gener Thu Sep 24 11:13 - 17:19  (06:06)
%d 博主赞过: