this post was submitted on 15 Dec 2025
15 points (100.0% liked)

Linux

14564 readers
74 users here now

Welcome to c/linux!

Welcome to our thriving Linux community! Whether you're a seasoned Linux enthusiast or just starting your journey, we're excited to have you here. Explore, learn, and collaborate with like-minded individuals who share a passion for open-source software and the endless possibilities it offers. Together, let's dive into the world of Linux and embrace the power of freedom, customization, and innovation. Enjoy your stay and feel free to join the vibrant discussions that await you!

Rules:

  1. Stay on topic: Posts and discussions should be related to Linux, open source software, and related technologies.

  2. Be respectful: Treat fellow community members with respect and courtesy.

  3. Quality over quantity: Share informative and thought-provoking content.

  4. No spam or self-promotion: Avoid excessive self-promotion or spamming.

  5. No NSFW adult content

  6. Follow general lemmy guidelines.

founded 2 years ago
MODERATORS
 

Just been supporting someone remotely and was waiting for them to turn on their laptop...

Whilst troubleshooting I ran uptime to see how long we'd been working on the problem and saw it was up for ~2 weeks...

Which made me think ... how do you tell how long a device (laptop) has been running, but since it's last suspend / hibernation?

I can find it from other clues such as journalctl -b -fu systemd-logind and look for Lid opened, but I was really looking for an smarter way...

Just a nice little challenge for anyone bored at this time of year :)

you are viewing a single comment's thread
view the rest of the comments
[โ€“] HelloRoot@lemy.lol 8 points 1 week ago* (last edited 1 week ago) (1 children)
journalctl --list-boots

If you see multiple entries without reboots, those intermediate boundaries are suspend/resume cycles.

you can get the last resupe time with either

journalctl -b -1 -g "PM: suspend exit"

or maybe

journalctl -g "resume from suspend"

I don't have my laptop with me rn, so it would be nice if somebody can confirm whether this works

[โ€“] Cyber@feddit.uk 2 points 1 week ago

Thanks, yeah, it looks like the journal is the main way.

I was also trying last and who, but they didn't help

And I was hoping there would be an easy systemd approach