「Linux如何查看上次关机时间」(linux上次关机时间)
The Last Shutdown Time Checking in Linux
Linux, as a popular and powerful operating system, serves millions of people around the world. Since it’s such an important tool, we all want to know how to check the last shutdown time in Linux. Here are the steps to do that.
First, open your Linux terminal and enter the command “last | head -2”. This will produce output like the following:
hongfeng@local:/$ last | head -2
shutdown system down 1.1.70 18:53
The output shows that 1.1.70 is the last shutdown time, which is 18:53.
Next, you can use the command “last -x” to view a list of uptime and shut down times. This command will produce output like this:
hongfeng@local:/$ last -x
reboot system boot 1.1.70 18:52shutdown system down 1.1.70 18:53
The output shows that the last shutdown time was 18:53, which is the same as what we found in the first command.
If you want to check the last shutdown time of a specific user, you can use the command “last -u username”. This will produce output like this:
hongfeng@local:/$ last -u hongfeng
reboot system boot 1.1.70 18:52shutdown system down 1.1.70 18:53
The output shows that hongfeng was the user who shut down the system at 18:53.
Finally, if you want to check the shutdown time for a specific date, you can use the command “last -t date”. For example, if you want to check the shutdown time for the date of 25th March, you can use the following command:
hongfeng@local:/$ last -t 0325
reboot system boot 1.3.25 18:52shutdown system down 1.3.25 18:53
The output shows that the last shutdown time was 18:53, which is on March 25th.
To sum up, Linux provides a few different commands to help you check the last shutdown time. By using the right command, you can easily learn the information needed.