How to move up a directory with Terminal in OS X

MacosTerminal

Macos Problem Overview


When I launch a new Terminal window, it starts me in 'Macintosh HD/Users/MyName'. How can I back out of my user directory, back up to the top level?

Macos Solutions


Solution 1 - Macos

cd .. will back the directory up by one. If you want to reach a folder in the parent directory, you can do something like cd ../foldername. You can use the ".." trick as many times as you want to back up through multiple parent directories. For example, cd ../../Applications would take you to Macintosh HD/Applications

Solution 2 - Macos

For Mac Terminal

cd ..   # one up
cd ../  # two up
cd      # home directory 
cd /    # root directory
cd "yaya-13" # use quotes if the file name contains punctuation or spaces

Solution 3 - Macos

Typing cd will take you back to your home directory. Whereas typing cd .. will move you up only one directory (the direct parent of the current directory).

Solution 4 - Macos

To move up a directory, the quickest way would be to add an alias to ~/.bash_profile

alias ..='cd ..'

and then one would need only to type '..[return]'.

Solution 5 - Macos

Let's make it even more simple. Type the below after the $ sign to go up one directory:

../

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJLeonardView Question on Stackoverflow
Solution 1 - MacosdavidcelisView Answer on Stackoverflow
Solution 2 - MacosD88naimiView Answer on Stackoverflow
Solution 3 - MacosJSON C11View Answer on Stackoverflow
Solution 4 - MacosempedocleView Answer on Stackoverflow
Solution 5 - MacosSaral KocharView Answer on Stackoverflow