How do I set the color of terminal bash prompt and background based on user or system profile ?

Solution Verified - Updated -

Issue

  • How to setup user or system profile to give user's different colored bash prompt  ?  So that when user login to different servers via ssh, they can identify between two machine based on terminal bash prompt color.

  • For example, Red terminal prompt for production servers, Green terminal prompt for test servers.

  • Note this will not change the background color of the entire screen - just the prompt line. The background color needs to be set by the terminal emulator settings (e.g. putty)

Environment

  • Red Hat Enterprise Linux (All Version)
  • Bash

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content