• Zur Hauptnavigation springen
  • Skip to main content
  • Zur Fußzeile springen

Sebastian Mogilowski's Blog

Just another blog about administration, linux and other stuff

  • Home
  • Contact
  • Imprint
  • Projects & HOWTOs
  • Publications

Color Bash Prompt on Ubuntu and Debian

29. Dezember 2011 by sebastian 2 Kommentare

Ubuntu

Green Prompt for your user

Edit “~/.bashrc“ and change:

#force_color_prompt=yes

to:

force_color_prompt=yes

To change it for all new users make the same in “/etc/skel/.bashrc“.

Red Prompt for root

Edit “/root/.bashrc“ and change “force_color_prompt=yes“ like for your user.

Now change the color to red. Search this line:

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

and change it to:

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

Note: For this change to take effect, you must log out then log in again.

Debian (older versions)

Green Prompt for your user

Open “~/.bashrc“ and append:

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

Red Prompt for root

Edit “/root/.bashrc“ and append:

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$ '

Other colors

Color	Code
Black	30
Blue	34
Green	32
Cyan	36
Red	31
Purple	35
Brown	33
Blue	34
Green	32
Cyan	36
Red	31
Purple	35
Brown	33

Kategorie: Linux, Systemadministration Stichworte: debian, ubuntu

Leser-Interaktionen

Kommentare

  1. jason404 meint

    18. Januar 2019 um 11:01

    You don’t need to log out and in again to see changes. Just `source ~/.bashrc‘.

    Antworten

Trackbacks

  1. Coloring the Debian shell (bash) | Armin's random ramblings sagt:
    29. April 2013 um 18:52 Uhr

    […] are many examples on how to achieve this, but I found the blog post by Sebastian Mogilowski the easiest to follow and have […]

    Antworten

Schreibe einen Kommentar Antwort abbrechen

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

eMail-Benachrichtigung bei weiteren Kommentaren.
Auch möglich: Abo ohne Kommentar.

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre, wie deine Kommentardaten verarbeitet werden.

Footer

Kategorien

  • Allgemein
  • Coldfusion
  • Development
  • Fun
  • General
  • Home automation
  • Homematic
  • Linux
  • Mobile
  • PHP
  • Privat
  • Systemadministration
  • Virtualization
  • Windows
  • Zaurus

© 2026 · Sebastian Mogilowski's Blog · Powered by Imagely