I've just installed iterm2 and found that it doesn't show the current working directory (i.e folder you are in) on each line. I thought iterm2 did this by default as it did this when I previously worked with it. Please see screenshot of what I am talking about. How do I configure it do it will display the working directory? (as per the screenshot). Thanks in advance!
each line should ideally display like this
I have tried going into the settings of iterm2, and also attempted to edit the bash_profile (couldn't find it).
I ran this google search: "configure bash prompt to include CWD". It resulted in many answers, such as this SuperUser question. There is more than one way to do this but perhaps the simplest, and most performant, is something along these lines:
PS1='\w> '
This is what happens on my system (which has an ancient version of Bash):
bash> PS1='\w> '
~> cd /tmp
/tmp> cd /var/log
/var/log> cd /usr/local
/usr/local>
You can obviously include anything else you want in the prompt. See the section in man bash
titled "PROMPTING" which lists the magic escape sequences you can include in the PS1
variable.