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 ..
?
If you have specific directories you want to move you can supply multiple directories to the mv command, the last one is taken as the dest - so mv /path/to/a /path/to/b /newpath will move "a" and" b"and all their subdirectories into be into /newpath.
The cd (change directory) command moves you into a different directory. To move out of that directory, use cd along with the path to some other location, or use double dots to backtrack, or return home to navigate from there. Navigating a Linux computer is like navigating the internet.
To navigate into the root directory, use "cd /" To navigate to your home directory, use "cd" or "cd ~" To navigate up one directory level, use "cd .." To navigate to the previous directory (or back), use "cd -"
Type cd \ into the prompt to go back to the directory. If you need to navigate from a location back to the main command prompt, this command takes you back immediately.
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.
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