# thanks: https://muffinresearch.co.uk/showing-last-two-directories-of-pwd-in-bash-prompt/ function PWD { pwd | sed 's/^\/Users\//~/' | awk -F\/ '{print $(NF-1),$(NF)}' | sed 's/ /\//' | sed 's/~\/~/~/' } export PS1="\u\[\e[m\]:\[\e[36m\]\$(PWD)\[\e[m\] " # backslash before $ tells it to run the function each time; # else it is only run once and won't update as you switch directories