How to change bash custom prompt ?

By default, the shell prompt has displayed the hostname and current working directory.
It is composed of some variables called:

  • PS1 – default value is \s-\v\$ .
  • PS2 – default is >
  • PS3 – is used as the prompt for the select command
  • PS4 – default is + and value of this parameter is expanded a to indicate multiple levels of indirection

Prompt is control via a special shell variable.y default, shell prompt is displayed hostname and current working directory.

Here’s how to set the default value:

The result will be:

You can export this with command export:

Here is a list of most of the options you can use for the BASH prompt with Linux.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.