I want something that looks like this:
Is there any way to achieve this? If so, how can I do this?
NOTE: I use Kubuntu Disco in case that is important.
For Kubuntu 19.04, install fonts-powerline using
sudo apt install fonts-powerline. Your system should also have fonts-hack.
Visit this site and copy the entire script, all 348 lines as on 20190906, to ~/bin and save it as powerline.sh or whatever. Use the file manager to make the script executable.
(Note that ~/bin is by default in your system's path and so you do not need something like
Open konsole and, from your home folder, run
echo "source powerline.sh" >> ~/.bashrc
Doing so will add
as the last line of your ~/.bashrc.
From your still open konsole window, run
to reload .bashrc and use powerline.sh in the existing konsole window.
If you want to go back to the default prompt, comment out the
source powerline.sh line in ~/.bashrc by placing a
# mark at the beginning of the line.
Read the contents of ~/bin/powerline.sh if you want to modify some aspects of the prompt.
Konsole, whether in Kubuntu 19.04 or Kubuntu 18.04, doesn't need fonts-powerline installed. But other terminals such as lxterminal and gnome-terminal need the package to get the triangles and the prompt to display nicely.
The appearance of the Bash command prompt is controlled by the environmental variable $PS1. By changing this environmental variable, you change the appearance of the prompt.
You can see the current setting of this variable with the command:
The prompt can be changed with the command
PS1="<string representing new format>"
To change permanently, change the definition of PS1 in the file
.bashrc in your home folder. That script is run automatically when you open a terminal, and includes a section where PS1 is defined.
To implement effects as appear in your screenshot, you may want to consider Powerline, a set of script developed to provide a more fancy look to the vim editor, but including scripts to change among others the bash terminal. Powerline can be installed with
sudo apt install powerline, and can then be used according to the documentation.
For more details regarding installation and use, refer to How can I install and use powerline plugin?, and in particular the answer of Schycken, because earlier answers have become obsolete.
The simplest way: https://ohmyz.sh/
And choose a theme like this one: https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#agnoster