We know that we can find our present directory using the pwd command on the Linux shell. What if you want it displayed as part of your shell prompt?
- Open the .bashrc file in your home directory.
- Add this line to the file:
export PS1='\[`[ $? = 0 ] && X=2 || X=1; tput setaf $X`\]\h\[`tput sgr0`\]:$PWD\$ '
- Restart the shell. Viola, your done 🙂