Is there a command or script that can tell me for how long the server has been up since installation?
(either by checking system installation date (+ removing shutdown-time) or by checking main disk uptime)
something similar to what "crystal disk info" can do for windows
Thanks
I do not believe we have something like that.
This will show when a system was installed:
Replace /dev/sda1 with the device name you need (1st column of
df /
will show you what you want). But I do not believe I ever saw a command to show how long a system has been turned on or off.will only show how long the current uptime is.
This will list the last 1000 reboots/shutdowns:
But that lacks the moment the system was turned on after a shutdown.
edit:
How about an approach like this (it will list the hours a disk has been active):
Replace
/dev/sda
with your device name and install it withsudo apt smartmontools
if not available yet. Not totally perfect as it assumes you started using the disk when the system was installed.I you had already installed the
downtimed
daemon (apt install downtimed
) to your system during installation, you could have obtained that information as shown in the following example:But, the current version of
downtimes
command does not display the cumulative time; you have to calculate yourself.Another option is the
last
command (as long as the/var/log/wtmp
file is not "rotated"). See the following example:The shows the system's "uptimes". But, again you have to sum them up yourself.