It is difficult work with the Terminal if you can't type the tilde. Does anybody know how to do this using a Spanish keyboard?
Using a Spanish keyboard and Spanish keybindings the tilde is altñ. Using English keybindings (System Preferences -> Keyboard -> Input Sources) and a Spanish keyboard it's still altn. If you immediately enter a / afterwards, you don't need an extra space.
Note: On some keyboards the two alt keys are different. To get the tilde, you may have to use the alt gr key located to the right of the spacebar.
On my Windows 10 and Ubuntu Linux with Spanish keyboard layout it is Alt Gr 4.
On Windows you will have to press space to only get the ~. Or something else that cannot be combined with the ~ like for example ã.
On my Linux I directly get the ~ character, but that behaviour is configurable.
I know it's the apple section. But I found this answer with Google searching for Windows and Linux. So I think my answer might be helpful.