There’s an insane number of things you can do to improve your Bash experience, one of which being changing up your command prompt.
There are couple of definitions to note within this section: the environmental variables $PS1 and $PS2. $PS1 refers to the primary command prompt, the one you see every time you open up a Bash terminal. $PS2 refers to the secondary command prompt, which is what you see when the terminal is expecting more input from you, like when you use gcalccmd.
I found the default primary command prompt to be a bit too long; it was eating up valuable screen space. Hence, I set it to something shorter, my initials in bold green, and a dollar sign: \e[1;32mKR$ \e[m.
However, when I used the Ctrl+p or the Up Arrow key to access the previous command, it sometimes held a part of the previous line in the command line. This did not affect the next command I ran, but it still bugged me.
Based on StackOverflow's answers, I enclosed my prompt in \[ and \], to get \[\e[1;32mKR$ \e[m\], but that was even worse.
Turns out, I didn't read the answers correctly. The solution is to change the command prompt, the value of $PS1 by enclosing things that begin with \e in \[ and \]. These are the nonprintable portions. I had to split this up into two different sections, one for each nonprintable chunk. Hence, I was left with \[\e[1;32m\] and \[\e[m\] once I had added in those sequences. The final solution was \[\e[1;32m\]KR$ \[\e[m\].
You can change the colors of how your directories, files and other things look when you list out the contents of a directory. This stuff is stored in an environmental variable called $LS_COLORS.
If you type
There are a gazillion options to customizing your setup, but a basic one could read as follows:
Let’s go through it bit by bit: