Often when I am using the command line in a terminal on Linux I need to go back more than one directory. Usually you use the command
cd ..
Which takes you back one level in a directory. For example if you are in /var/www/http and you type cd .. you will be in directory /var/www/.
But what if you are super deep in the directory and need to get back to www directory. Say you are in /var/www/http/website/public and you want to get back to /var/www/http you can either type:
cd .. ( inside /var/www/http/website/ )
cd .. (inside /var/www/http/ now )
But you can type the following and get all the way back to the /www/http/ directory in one line
cd ../..
That line will take you back two directories. If you need to go further back just continue adding ../..
Comments
One response to “How to go back multiple directories in a linux terminal command line”
discover popd, pushd and z
You must log in to post a comment.