pwshub.com

Check Laptop Battery Health in Ubuntu from the Command Line

Want to check your battery health in Ubuntu from the command-line, no need to install anything extra?

Most of using Ubuntu on a laptop will monitor battery level from the top bar (enabling battery percentage in the top bar is something I always do), and dive into the Settings > Power panel for more details as and when needed.

However, those methods only show current battery levels, and how long until you need to recharge. They don’t tell you anything about the health of your laptop battery.

If you want more information, Ubuntu pre-installs the Power Statistics utility. The GUI tool provides updating graphs showing charging history, power usage, and a ‘details’ tab with a wealth of information.

But if you’re someone who spends a lot of time in terminal, prefer its, or you’re using an Ubuntu flavour or offshoot that doesn’t include the Power Statistics app, you can easily see battery condition and other information from the command line.

Perhaps you’ve noticed your laptop needs recharging more often, that the battery no lasts as long as it used to. Batteries have finite lifespans, and if you let them run down completely, then recharge fully, repeatedly, it lessens the charge they can hold.

But how many cycles has your battery gone through? And what is its current capacity compared to when it was all shiny and new?

To find out all of that (and more) from the command line, quick and easy, follow these steps.

Find Battery Capacity & Cycle Count from CLI

See battery info from the command line

The steps below will work on most Linux distributions, not just Ubuntu

Using upower, we can check see the battery vendor, model number, and capacity info, including current max capacity, original max capacity, cycle count, time to empty, and how much power is getting drawn from the battery at the time the command is run.

  1. Open a new Terminal window
  2. Run upower --enumerate
  3. Copy the path printed for your battery (usually ends in ‘_BAT0’)
  4. Type upower -i and paste your battery device path

The path to your battery may differ from the example above but, on most laptops I use this on, it’s always the same.

So in the screenshot embedded above you can see the first command shows my laptop battery path as /org/freedesktop/UPower/devices/battery_BAT0. I then run this with the second, i.e., upower -I /org/freedesktop/UPower/devices/battery_BAT0.

So what do the stats tell you?

The energy-full stat is the current maximum charge your battery holds, while energy-full-design is the maximum battery capacity the battery was built to hold. Further down capacity shows the difference as a percentage.

In my screenshot, you can see that the battery left the factory designed to hold 53.9 Wh. Now, it only holds 38.8 Wh. The current capacity is now 71.9% of what it was when new (which for a 6 year old laptop isn’t bad going – I think).

If you’re interested in knowing your cycle count, the charge-cycles label tells you how many times the battery has been totally flat to totally charged. In my screenshot, you can see that’s 194 time.

GUI options exist of course

And that’s how to check your battery health, capacity, and cycle count from the command line in Ubuntu using upower. This guide is specifically written for those who want to know how to get this info from the command line, not a GUI app.

But there are other ways to get battery information on Ubuntu, and the Power Statistics app I mentioned at the start is arguably more user-friendly.

But if you prefer the command line, and you your info in one clean printout, then upower is worth knowing about.

Source: omgubuntu.co.uk

Related stories
4 days ago - If you’re looking for a no-fuss way to monitor real-time power consumption on your Ubuntu laptop, a new GNOME Shell extension makes it deliciously easy. “Why would I want to see energy usage?” – anyone asking that question probably...
1 month ago - Build a minimal 3D web application to showcase designs on a laptop and phone in an interactive environment using Three.js and threepipe.
3 weeks ago - I’ve not booted into the Windows partition on my Chuwi laptop for a few months, but having heard that a recent Windows update leaves dual-boot users unable to boot Linux at all, I’m rather relieved I haven’t! As...
1 month ago - The first step to getting started with Python is to install it on your machine. In this tutorial, you'll learn how to check which version of Python, if any, you have on your Windows, Mac, or Linux computer and the best way to install the...
1 week ago - Get a sneak peek at the upcoming features in Python 3.13 aimed at enhancing performance. In this tutorial, you'll make a custom Python build with Docker to enable free threading and an experimental JIT compiler. Along the way, you'll...
Other stories
30 minutes ago - The right fonts can make your website user-friendly and enjoyable, while poor readability and contrast can ruin your design. The post Types of fonts and when to use them appeared first on LogRocket Blog.
1 hour ago - Pushing the boundaries of generative AI, Meta unveils Llama 3.2, a groundbreaking language model family featuring enhanced capabilities, broader applicability, and multimodal image support, now available in Amazon Bedrock.
1 hour ago - You can implement prioritization methods within your product roadmaps to help streamline and simplify the process. The post Prioritizing user stories in agile product management appeared first on LogRocket Blog.
1 hour ago - Use the Claude Artifacts feature to generate prototypes of user interfaces, saving you development time and giving you a way to easily visualize your plan. The post Implementing Claude’s Artifacts feature for UI visualization appeared...
1 hour ago - Pilot testing as a PM can help you gather real user insights, de-risk ideas, adapt quicker, and avoid expensive mistakes. The post Conducting effective pilot testing as a product manager appeared first on LogRocket Blog.