Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[Info] colored bash-prompt

Featured Replies

Over a year (or two?) I used a PS1-line in my ~/-bashrc with many cryptic ANSI-Escape-codes which were hard to read and edit :(

 

export PS1='\[\033[1;36m\]\u\[\033[1;37m\]@\[\033[1;33m\]\h\[\033[1;37m\](\[\033[1;32m\]$THEIP\[\033[1;37m\])\[\033[1;31m\]:\[\033[1;36m\]\w\[\033[1;31m\]\$\[\033[0m\] '

Today I did installed Linux Lite 4.6 on a PC (a former Chromebox) and did see the nice Powerline prompt and did try to use that on a nanoPi Neo2.

I installed the packages fonts-powerline &  powerline and copied the powerline-script /usr/share/powerline/bindings/bash/powerline.sh

from the pc to the NanoPi Neo2.

It did work after I used UTF8 translation in pUTTY, but it wasnt very perfomant :(

 

So I decided to cleanup my PS1 line for better reading,

 

I had to define some variables and then I did put these in my PS1 export line in ~/.bashrc:
 

export THEIP="$(/sbin/ifconfig | grep "inet " | grep -v 127.0.0. | awk '{print $2}')"
BRed='\[\033[31;1m\]'
BGreen='\[\033[32;1m\]'
BYellow='\[\033[33;1m\]'
BCyan='\[\033[36;1m\]'
BWhite='\[\033[37;1m\]'
Reset='\[\033[0m\]'
UserPromptPS1='\$'
export PS1="${BCyan}\u${BWhite}@${BYellow}\h${BWhite}(${BGreen}${THEIP}${BWhite})${BRed}:${BCyan}\w${BRed}${UserPromptPS1}${Reset} "

# \u    = User
# @     = @
# \h    = Host
# \w	= working directory
# \$	= # for root (uid=0) or $ for user

That worked well and did give me the same result as my old but bad readable PS1-line

Now its - for me - much more easy to edit ;)

 

As Information some more useable color-definition (B before the color is for Bright and colors starting with On are for the Background):

Black='\[\033[30m\]'
Red='\[\033[31m\]'
Green='\[\033[32m\]'
Yellow='\[\033[33m\]'
Blue='\[\033[34m\]'
Magenta='\[\033[35m\]'
Cyan='\[\033[36m\]'
White='\[\033[37m\]'

BBlack='\[\033[30;1m\]'
BRed='\[\033[31;1m\]'
BGreen='\[\033[32;1m\]'
BYellow='\[\033[33;1m\]'
BBlue='\[\033[34;1m\]'
BMagenta='\[\033[35;1m\]'
BCyan='\[\033[36;1m\]'
BWhite='\[\033[37;1m\]'

OnBlack='\[\033[40m\]'
OnRed='\[\033[41m\]'
OnGreen='\[\033[42m\]'
OnYellow='\[\033[43m\]'
OnBlue='\[\033[44m\]'
OnMagenta='\[\033[45m\]'
OnCyan='\[\033[46m\]'
OnWhite='\[\033[47m\]'

OnBBlack='\[\033[40;1m\]'
OnBRed='\[\033[41;1m\]'
OnBGreen='\[\033[42;1m\]'
OnBYellow='\[\033[43;1m\]'
OnBBlue='\[\033[44;1m\]'
OnBMagenta='\[\033[45;1m\]'
OnBCyan='\[\033[46;1m\]'
OnBWhite='\[\033[47;1m\]'
Reset='\[\033[0m\]'

 

color_prompt.jpg

powerline_prompt.jpg

Hi @guidol,

 

You describe your journey to this result, but let's think about somebody who just wants to rebuild your config. Can you do a step by step without your legacy ?

 

Thank you in advance :beer:

 

  • Author
10 hours ago, Tido said:

You describe your journey to this result, but let's think about somebody who just wants to rebuild your config. Can you do a step by step without your legacy ?

which of the 2 configs you want to rebuild?

for the non-chromebox (colored on black) prompt line there is already everything you need to put on the end of your ~/.bashrc in the first source-part box above.

 

for the chromebox prompt you need to install the 2 packages fonts-powerline &  powerline via

apt install fonts-powerline powerline

copy powerline.sh to your home-directory:

cp ./powerline.sh ~/

and append at the end of your ~/.bashrc the line:

source ~/powerline.sh

and change pUTTY to UTF8-translation:

Change Setting => Window => Translation => Remote character set => UTF-8 => Apply

or save it directly to your pUTTY session

 

then activate the new ~./bashrc while starting a new bash with

bash

or reboot

 

BTW: you have to change the ~/.bashrc for every user where you want to use it - for me these files are

/home/root/.bashrc    and

/home/guido/.bashrc

 

Do you got any other questions? ;)

 

powerline.sh

Hi Guido,

 

Thank you. As you mentioned several components I wasn't sure what is really needed and to install was a bit overkill, at first sight.

I could have gone ahead with try and error, but as you already have the knowledge, I thought it was better to ask.

 

Apart from that, others can now also easily benefit from your lesson 😊

 

Cheers,

Tido

On 11/7/2019 at 9:55 AM, guidol said:

Over a year (or two?) I used a PS1-line in my ~/-bashrc with many cryptic ANSI-Escape-codes which were hard to read

 

hard to read - that's a good point in general with ANSI in general - part of the problem for me is that I have challenges in color vision, so some distros and/or terminals default to items I honestly have trouble with.

On 11/7/2019 at 9:55 AM, guidol said:

a former Chromebox

 

How old of a chromebox - is it still supported by ChromeOS?

 

(FWIW - there are more than a few ChromeBoxes and ChromeBooks that are end of support, so it's a legit question)

 

More recent versions of ChromeOS have linux app support via Crostini - much easier that Crouton or Gallium that break security of the platform by going into dev mode.

  • Author
10 hours ago, sfx2000 said:

 

How old of a chromebox - is it still supported by ChromeOS?

(FWIW - there are more than a few ChromeBoxes and ChromeBooks that are end of support, so it's a legit question)

More recent versions of ChromeOS have linux app support via Crostini - much easier that Crouton or Gallium that break security of the platform by going into dev mode.

@sfx2000 My Chromebox was supported until September 2019 ;)

but one year ago I installed the SeaBIOS ( https://mrchromebox.tech/#home ) and use it as a real PC.

Its a HP CB1-020NG ( Intel Celeron 2955U, 2x 1.40GHz ) and I updated it with 8GB RAM (only one socket)

and a 120GB SSD ( running cool & quiet ) :)
I also got a old Samsung ARM Chromebook :)

 

CB1-020NG.jpg

On 11/9/2019 at 7:38 AM, guidol said:

Its a HP CB1-020NG ( Intel Celeron 2955U, 2x 1.40GHz ) and I updated it with 8GB RAM (only one socket)

 

That's actually one of the nicer units, similar to the Windows Stream Mini boxes with different UEFI and obviously windows.

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.