How do I make the command line prompt display different information?

Updated -

To manipulate the prompt on the command line, the PS1 environment variable can be used. The PS1 environment variable is part of the bash package. It can be useful to users who wish to know the system's hostname, the directory they are currently working on, the date and the current time.

Some of the most common PS1 options are listed below:

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In