Archive for February, 2022

Change server terminal command prompt

If you deal with a lot of server, sometimes it can get tricky to keep track of which one you’re on…so a simple way to help that is to color code and name them in the command prompt.

All you need to do is:

  1. nano ~/.bashrc
  2. uncomment #force_color_prompt=yes
  3. Find a line like this:
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
  4. And Change it to something like this:
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;35;40m\]Staging \u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

For this I made it pink and added “Staging” before the hostname.  01;32m was the default color and I just needed to change it to 01;35m.  Below is a handy chart I found with all the ubuntu color codes.



Permalink » No comments