Command-Line – Quickly Move Into and From Deeply Nested Directories

bashcommand linedirectory

We know that using cd <directory> will open the directory, if it exists!

Also, cd .. will take us up one level from the current working directory.

But, when we have a nested dir with longer path like /home/thina/teams/td/tech/app/release/apks, it is tiring to just go into the folder apks and also it is hard to get back to another node, say here /home/thina/teams.

Is there any way to skip the typing of cd and cd ..? I'm using Ubuntu 16.04.

Best Answer

There is pushd and popd:

pushd /home/thina/teams/td/tech/app/release/apks
# current directory now /home/thina/teams/td/tech/app/release/apks
# current directory now what it was before pushd command

Try help pushd and help popd for more options. There is no man page, because pushd and popd are bash built-in commands.