2 Methods to Get Last System Boot Date and Time on Linux

2 Methods to Get Last System Boot Date and Time on Linux

Monitoring the boot date and time of a Linux system is crucial for system administration and troubleshooting. Knowing the last boot date and time is essential for diagnosing performance issues, assessing system stability, and ensuring maintenance compliance. This tutorial provides 2 methods how to get last system boot date and time on Linux.

Method 1 - uptime command

The uptime command provides a straightforward way to check when the system was last booted.

uptime -s

Output example:

2025-02-17 15:42:49

Method 2 - /proc/uptime file

Another way to determine the last boot time is by calculating it using the system's uptime from /proc/uptime file. The following command does this:

date -d "now - $(awk '{print $1}' /proc/uptime) seconds" +"%Y-%m-%d %H:%M:%S"

This command extracts the system's uptime in seconds and subtracts it from the current time, effectively giving you the last boot time.

Leave a Comment

Cancel reply

Your email address will not be published.