In my .bash_profile I currently have
PS1="$ "
which in my terminal returns '$ '
I want to show the current folder as well.
if I run the command, pwd /Users/Me/Sites/
I would want my bash prompt to return 'Sites$'
Thanks for all your help.
Use pwd to identify the current directory of your Terminal session. Use ls to list the files in the current directory of your Terminal session. Use cd and cd .. to change directories of your Terminal session. Use open . to open the current directory of your Terminal session in Finder.
By default, bash shows just your current directory, not the entire path. To determine the exact location of your current directory within the file system, go to a shell prompt and type the command pwd. This tells you that you are in the user sam's directory, which is in the /home directory.
bash_profile for Mac Users. There is a hidden file in your Mac's user directory named . bash_profile. This file is loaded before Terminal loads your shell environment and contains all the startup configuration and preferences for your command line interface.
Bash prompt can be set by setting the environment variable PS1 . Current directory can be displayed in 3 types: Full path.
Note that if you don't want brackets or colors surrounding the current directory, you can use the simpler:
export PS1="\W$ "
try this:
PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] [\w]\[\033[00m\]'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With