What Is the Ps1 Variable in Linux?

What Is the Ps1 Variable in Linux?
Contents

The command prompt and terminal appearance are governed by an environment variable called PS1 . According to the Bash man page, PS1 represents the primary prompt string which is displayed when the shell is ready to read a command.

What is PS1 variable?

PS1 is a primary prompt variable which holds [email protected] W\$ special bash characters. This is the default structure of the bash prompt and is displayed every time a user logs in using a terminal. These default values are set in the /etc/bashrc file.

What is the function of PS1 variable?

PS1: environment variable which contains the value of the default prompt. It changes the shell command prompt appearance and environment. PS2: environment variable which contains the value the prompt used for a command continuation interpretation.

Sarah Jenkins
Author

Sarah Jenkins

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.