+3 votes
248 views
How to know when a Linux server was shut down or restarted

in Linux / Unix by (552k points)
reopened | 248 views

1 Answer

+4 votes
Best answer

1. How to see the last system start in Ubuntu Linux
2. How to see the latest system reboots in Ubuntu Linux
3. How to see the shutdowns of the operating system in Ubuntu Linux
4. How to see the system uptime in Ubuntu Linux

Many of us are systems administrators or within our roles is the part of corporate security, it is essential to take into account some basic aspects when managing the various teams and one of these is to know exactly when the equipment was turned off , when a restart occurred, when it was turned on, etc. This will help to better control this type of actions and the day that we execute an audit to know exactly how to offer the maximum details (we all know the work involved in an audit)..

So TechnoWikis will help you with these loads explaining how we can see in detail when a server was shut down or when it was restarted. Although it seems simple, remember the great difference between a server and a client computer. While the client computer can be turned off naturally every day, the server integrates a series of roles, services and processes that require you to be active 24 hours a day, 7 days a week and 365 days a year, therefore, a Shutdown or a reboot will affect many other processes in the organization.

We also leave you the videotutorial with the necessary steps to use the terminal and show you the log of the processes of shutdown and restart of Linux..

To stay up to date, remember to subscribe to our YouTube channel! SUBSCRIBE


1. How to see the last system start in Ubuntu Linux

For this case we are using Ubuntu 18 Server, if we want to know in detail the last power on the computer.
We can use the who command with the -b parameter which will give us both the date and the exact time in which this task was carried out.

 who -b 
image
Note
This command does not require superuser privileges.

2. How to see the latest system reboots in Ubuntu Linux

Step 1

Now, to access this information, we will use the last command next to the reboot parameter, this will give us a report of when the equipment was restarted indicating date and time of the same:
 last -x reboot 
image
Step 2

It is possible to channel the result displayed with the previous command, if we use the value -1, we are indicating that only one line is displayed. If we use the value -2, we will see both lines where the current system start is included.
 last -x reboot | head -1 
image

3. How to see the shutdowns of the operating system in Ubuntu Linux

Step 1

This is another of the critical points in the management of servers and is to access the last shutdowns of the operating system, in this case we will also use the last parameter like this:
 last -x shutdown 
image
Step 2

As we can see there, information is offered on the date, time and range of time used. As with the restart, it is possible to filter only the last shutdown or the other shutdowns as we deem necessary using head:
 last -x shutdown | head -1 
image

4. How to see the system uptime in Ubuntu Linux

Step 1

It is another of the important aspects in the management tasks since this option allows us to identify how long the computer has been on, in this case we will use the uptime command with the -p parameter in the following way:
 uptime -p 
Step 2

As a result we will see the rotal time in hours and minutes that the operating system has been running on: image

Thanks to these simple commands, we will be in the position to access vital system information which is support for various administration, support and management tasks as it allows us to collect specific details about these aspects of the system..


by (3.5m points)
edited

Related questions

+4 votes
1 answer
+3 votes
1 answer
+4 votes
1 answer
+5 votes
1 answer
Sponsored articles cost $40 per post. You can contact us via Feedback

Most popular questions within the last 30 days

10,659 questions
10,791 answers
510 comments
3 users