Search code examples
macosunixterminaltilde

Appearance of a tilde(~) in mac OSX terminal in the path


I am new to the Mac OSX environment, and was programming in C using the terminal. To change the current directory, I used the command cd .. to go one level up. However, this had a weird effect on the terminal. A clear screen on my mac terminal normally used to show this path always-

manishs-mbp:manishgiri$

However, since the time I did cd .. (to go one level up), the current pathway of the terminal has changed to:

manishs-mbp:~ manishgiri$

As you can see, there is a tilde now in the pathname. On reading about it, it looks like this tilde is used to represent the home directory in mac os. However, i would like to get rid of it, as it was earlier.

I tried to think of it, and realized that cd .. would have taken me one level up. So, I entered pwd in the terminal to see the current pathway(this is with the tilde situation), and got this-

manishs-mbp:~ manishgiri$ pwd
/Users/manishgiri

Maybe the tilde appears because I am now by default in the /Users(Home) folder. If that's the case, then how do I revert it back to the previous settings to get rid of the tilde?

Any help on this would be highly appreciated, thank you.


Solution

  • Try

    PS1=`pwd `
    

    to set your prompt.

    If you like that, check in your home directory for a file called .profile and edit PS1 setting permanently into there.

    This may help.