How To Install xbattbar on Ubuntu 18.04

In this tutorial we learn how to install xbattbar on Ubuntu 18.04. xbattbar is Display battery status in X11

Introduction

In this tutorial we learn how to install xbattbar on Ubuntu 18.04.

What is xbattbar

xbattbar is:

Xbattbar displays the current (laptop) battery status in the X window environment. Battery status is obtained through the APM interface.

The battery indicator of this program is very simple: a simple bar at the top/bottom of your display. With its color, it indicates the AC-line status (plugged in or off-line), and battery charging/remaining level. Also, if the mouse cursor enters the indicator window, a popup diagnosis window comes up in the center of your display showing the current AC line status and battery level.

This package supports ACPI and APM checks for battery status.

There are three methods to install xbattbar on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install xbattbar Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install xbattbar using apt-get by running the following command:

sudo apt-get -y install xbattbar

Install xbattbar Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install xbattbar using apt by running the following command:

sudo apt -y install xbattbar

Install xbattbar Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install xbattbar using aptitude by running the following command:

sudo aptitude -y install xbattbar

How To Uninstall xbattbar on Ubuntu 18.04

To uninstall only the xbattbar package we can use the following command:

sudo apt-get remove xbattbar

Uninstall xbattbar And Its Dependencies

To uninstall xbattbar and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove xbattbar

Remove xbattbar Configurations and Data

To remove xbattbar configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge xbattbar

Remove xbattbar configuration, data, and all of its dependencies

We can use the following command to remove xbattbar configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge xbattbar

References

Summary

In this tutorial we learn how to install xbattbar package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.