Powerline, customize the command line in Ubuntu

about power line

In the next article we are going to take a look at Powerline. This tool can be very helpful when it comes to organizing ourselves as it offers useful information on the terminal that we will see at all times. Powerline is a status line plugin for vim, and provides status lines and prompts for other applications, including zsh, bash, fish, tmux, IPython, Awesome, i3, and Qtile.

As indicated in Killer tomatoes, it is a python script to have a hypervitaminized command line. Basically we can customize the command line to suit the user. When we use the command line locally, we can see it with a configuration, and when we use it remotely, we can clearly differentiate it.

General Powerline Features

powerline running

  • Es extensible and feature rich. This application was completely rewritten using Python. This has achieved a much better extensibility, more agile, better and simpler configuration files. Plus a structured, object-oriented code base with no mandatory third-party dependencies other than a Python interpreter.
  • Stable base code. Using Python, it was possible to unit test all the code in the project. The code is tested to work with Python 2.6+ and Python 3.
  • Includes support for prompts and status lines in many applications. Originally built exclusively for vim status lines, the project has evolved to provide status lines in tmux and various WMs, shells like bash / zsh, and other applications.
  • The configuration and color schemes have been written in JSON. This is a standardized, simple, and easy-to-use file format. It allows easy configuration by the user in all compatible applications.
  • Powerline is fast and light, with daemon support for even better performance. Although the code base spans a couple thousand lines, the main focus is on good performance and as little code as possible. At the same time it provides a wide set of features. The new daemon also ensures that only one Python instance is started for prompts and status lines, providing excellent performance.

These are some of the features of Powerline, all of them can be consulted in more detail in the official project documentation or in GitHub page.

Install Powerline on Ubuntu

To install Powerline in Ubuntu, we will have different options. All of them can be consult the project documentation. We will be able to install it from pip, but it is more recommended (although it will not be the latest version) to install it from the package manager. In this example, we are going to make use of apt for installation.

First we are going to update the available software index and then we can proceed with the installation. For this you just have to open a terminal (Ctrl + Alt + T) and write the script:

powerline installation with apt

sudo apt update && sudo apt install powerline fonts-powerline

Once the packages are installed, we must modify the .bashrc file from our user with the command:

vim ~/.bashrc

Inside the file, at the end of the whole, we will only have to include the following content. With these lines we are going to check if the file powerline.sh exists in the installation path:

bashrc modification

if [ -f /usr/share/powerline/bindings/bash/powerline.sh ]; then
source /usr/share/powerline/bindings/bash/powerline.sh
fi

Once the changes have been made, we can now save and exit the text editor that we use. To see the changes, it is best to restart the terminal.

working tool

Basic configuration

We will be able change different options of Powerline settingssuch as the color palette, main settings, or theme. For this we must work with different files, as shown in the official documentation.

In Powerline you can configure different zones or sides, in a typical shell you have the prompt on the right. Help can be found about possible configurations in the official documentation. In it you can obtain information on how to modify and adapt them to the specific needs of each user.


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Eduardo Navas said

    I have spent a while reading the documentation and testing the tool, it has seemed very good and complete. XD