0

When Linux is booting there are timestamps which time something was loaded etc, so I think that information about boot start time must be available. Is there a way to run in any moment command or something that shows how many seconds until boot is, like for example 10.3452232?

It should work on busybox init system.

IzZy
  • 135
  • 4

1 Answers1

1

Sounds like you are looking for /proc/uptime. This is inbuilt in the Linux kernel so should be available on any system.

From the manual: https://man7.org/linux/man-pages/man5/proc.5.html

/proc/uptime
          This file contains two numbers (values in seconds): the uptime
          of the system (including time spent in suspend) and the amount
          of time spent in the idle process.

You can read this with a simple:

cat /proc/uptime

Or in a script:

read uptime idle < /proc/uptime
echo $uptime
Philip Couling
  • 17,591
  • 5
  • 42
  • 82