What is the purpose of the command prompt PS1?


What is the purpose of the command prompt PS1?


The command prompt (PS1) often plays the role of guide, as a default on a terminal window, we can commonly see that it is composed of usually three pieces of information, 1. the user, 2. the machine (computer name), and 3. the name of the current directory, all within brackets and followed by an iconic $ that lets us know that there is where we can start typing on the command line, for example, if I were to be the user, my computer’s name were to be sparky, and the currently directory were to be called bash_exercise, my prompt would look like so:

[AxelKaban@sparky bash_exercise]$

some prompts provide more or less information. In the case of the Codecademy prompt, it usually is simply $ which denotes that there is a normal user working, which again is a basic setting.

Using nano to open our .bash_profile we could adjust what we want to see on our PS1, maybe our interest is mainly aesthetic, and thus we could make it pretty with our name, the machine’s name, a heartfelt or positive quote, and even emojis, because its main purpose is to guide us and provide valuable information, so why not update it with a series of uplifting emojis! Or the birthdate of that special someone we keep on forgetting about.