A beautiful, efficient and useful PS1 prompt for your bash shell
A Powerline like prompt for Bash using bash scripts
This implementation was inspired by Powerline-Shell. But that version, which is based on python, was exceedingly slow for my taste, taking upto 1.5 seconds for the shell prompt to be set with the python script. Hence, I decided to recreate the appearance created in that prompt using only shell scripts.
Consequently this is not nearly as readily configurable as python based one above. However, with a little bit of effort and knowledge of shell scripts, you can make this look however you desire.
⏎
followed by number
⚑
✚
✘
In addition, the following symbols are used to separate different segments: ,
This shell script heavily relies on ANSI color codes to display colors in the terminal window.
They may not be portable, hence it may not work for you out of the box. You may need to set
your $TERM to xterm-256color
.
In addition, Unicode symbols require a special font to be used in your terminal. Please use one of the powerline fonts available at: https://github.com/Lokaltog/powerline-fonts
You may need to use uxterm
, the XTerm with unicode support, in place of xterm
if the
Unicode characters are not correctly rendered.
This script uses the __git_ps1
command to identify if a directory is a git repository, and if
it is, identify the branch name. If you do not have this command, please install it for your system.
Clone this repository, or copy the ps1_prompt
shell script to a suitable location. Let us assume
that you placed this in your home directory.
In your .bashrc
or .profile
, whichever is used, source the ps1_prompt
script as follows:
source ~/ps1_prompt
At this point, this script has no simple option for customization apart from manually editting the script to your liking. Once you get the flow of the script, and after familiarizing yourself with the ANSI color codes, it should be fairly straightforward to enhance the script to your taste.
Some resources that can help you with tweaking the script:
If you can contribute to make this script more customizable, please do so and submit a pull request!