Search code examples
linuxcd

Go up several directories in linux


When I want to go one directory up I use

cd ..

But when I want to go 7 directories up is there any way to do this other than just typing seven (7) times cd .. ?


Solution

  • cd ../../../../../../../
    

    Also another useful navigation tip is if for example lets say you keep switching from a directory (call it A) to another (call it B) that's 7 directories up, in your case.

    So if you're in directory A:

    A> cd ../../../../../../../
    B> // Now you're in directory B and want to go back to A
    B> cd -
    

    That will move right back to directory A. - expands to the previous directory you were in.