Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Two ways for linux to check whether the system is restarted

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Today, the editor shares with you two ways for linux to check whether the system is rebooted. Many people don't know much about it. Today, in order to give you a better understanding of how linux checks whether the system is restarted, I summarize the following contents. Let's look down together. I'm sure you'll get something.

You can further determine whether the system has been rebooted by querying the time of the last restart of the system.

Method 1: last command

# last rebootreboot system boot 2.6.32-431.el6.i Wed Jul 30 13:44-21:39 reboot system boot 2.6.32-431.el6.i Sun Apr 13 14:28-09:27 (107-18 431.el6.i Sun Apr 59) reboot system boot 2.6.32-431.el6.i Tue Mar 25 22:27-14:19 (18-15 431.el6.i Sun Apr 52)

This command actually shows how long the system has been running in recent days.

Last was originally designed to display the login history of a particular user. In Linux, there is a special "pseudo user" called reboot who automatically logs in immediately when the system is rebooted. This way you can check the last restart time by checking the login history of reboot users.

Method 2: who-b

Use the who command with the'- b 'option.

# who-bsystem boot Jul 30 13:44

Method 3: uptime command

You can also use the uptime command to infer the last startup time of the system. The uptime command displays the current time, as well as the time that the system has been running. From this information, you can calculate the last startup time of the system.

# uptime21:46:31 up 46 days, 8:02, 1 user, load average: 0.04, 0.05, 0.01

The above is a brief introduction of the two ways for linux to check whether the system is rebooted. Of course, the differences in the detailed use of the above have to be understood by everyone. If you want to know more, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report