Bash Prompt: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
Line 8: Line 8:
=Overview=
=Overview=


Set PS1 environment variable in .bashrc.
Set PS1 environment variable in .bashrc. PS1 is a primary prompt variable. PS2 bash shell variable is a secondary prompt. This prompt is displayed if the shell waits for a user input.


If used in PS1 definition, the following control character are rendered to various pieces of information:
If used in PS1 definition, the following control character are rendered to various pieces of information:
Line 14: Line 14:
* \u username
* \u username
* \H host name
* \H host name
* \h host name up to the first "."

Revision as of 03:38, 16 July 2020

External

Internal

Overview

Set PS1 environment variable in .bashrc. PS1 is a primary prompt variable. PS2 bash shell variable is a secondary prompt. This prompt is displayed if the shell waits for a user input.

If used in PS1 definition, the following control character are rendered to various pieces of information:

  • \w working directory
  • \u username
  • \H host name
  • \h host name up to the first "."