Colorful Bash on SSH with Syntax Highlighting (Ubuntu)

Advertisement

Here is How To Get Custom Colorful Bash on SSH on Ubuntu and Other GNU Linux Along With Syntax Highlighting for Nano Text Editor. Quite Easy Steps. While iTerm2-Homebrew-Oh-My-ZSH gives hundreds of colors, it is quite pathetic to work with white colored texts with some color provided by iTerm2. No worries, you will get colorful Bash on SSH with Syntax Highlighting on your Ubuntu or other GNU Linux instances.

Colorful Bash on SSH with Syntax Highlighting : First Things First

We have discussed about how to get Nano Syntax Highlighted in our previous guide. Do not make Nano your default text editor. Do not change Bash to ZSH as default shell.

Colorful Bash on SSH with Syntax Highlighting : Methods

Understand this – if you login as ubuntu then run sudo su to become root, then you have to do the steps twice – one for ubuntu and one for root. We usually keep the /root directory clean. But, as root‘s $HOME is at /root, we will do the things here, so – do not delete the things recursively later.

When we are using iTerm2 to SSH to Ubuntu instance, iTerm2 and ZSH will force some color, but not much. There are two steps of the work. Remember what you have done by writing it somewhere. We might change or correct steps later to make all Linux distort working in the same method.

You can not see the dot file named .bashrc at /root. So, first :

Vim

1

cd~&&nano.bashrc

Just look at it. Actually there is a commented out line with a comment indicating if you uncomment, you’ll get some color. It varies from distro to distro. But you will find it and it is very easy to guess from the comment. uncomment it and source the bash file :

Vim

1

source.bashrc

You will get some colors. We are talking about two steps. Possibly, we can say – two options. If you are satisfied with this, you need not to do the next step. The next step is using a ready to use Oh-My-ZSH Theme clones intended for Linux desktop. Take a manual backup of the .bashrc file. If you do not like the things, you can simply delete the modified .bashrc and make the backup active and run source ~/.bashrc.

Advertisement

---

Colorful Bash on SSH with Syntax Highlighting : Using Ported Theme

You are at /root. You have git installed, if not, run :

Vim

1

2

3

4

apt install git

#apt-get install git#on older Ubuntu

apt update

apt upgrade

apt command works fine now. After that, do these :

Vim

1

2

3

4

git clone https://github.com/AbhishekGhosh/bash-it.git~/.bash_it

cd~/.bash_it&&ls

chmod+xinstall.sh

~/.bash_it/install.sh

This will ask you questions (your .bashrc will be backed up too). This will be the questions and you’ll answer in this way :

Vim

1

2

3

4

5

6

7

\.~/.bash_it/install.sh

Your original.bashrc has been backed up to.bashrc.bak

Copied the template.bashrc into~/.bashrc,edit this file to customize bash-it

Do you use Jekyll?(Ifyou don't know what Jekyll is, answer 'n')[Y/N][n]

Would you like to enable all,some,or no aliases?Some of these may make bash slower to start up(especially completion).(all/some/none)[none]

Would you like to enable all,some,or no plugins?Some of these may make bash slower to start up(especially completion).(all/some/none)[all]

Would you like to enable all,some,or no completion?Some of these may make bash slower to start up(especially completion).(all/some/none)[none]

All, None etc. are typed input by us. As we are not using a Desktop, we need to comment out certain stuffs. Open :

You’ll get the thing exactly we have shown in the screenshot. This Theme method is not exactly, which is comfortable for SSH. Actually, the .bashrc should be edited itself. That is third method, Arch Linux has excellent peoples who loves these odd stuff at 30-70 years of age :

Vim

1

https://wiki.archlinux.org/index.php/Color_Bash_Prompt

Whenever there is color related thing and searching our website or asking us does not give properly reply, go to Arch Linux Wiki. We are not color expert, but better to follow some website, which is running for few years and works around core stuffs.