Hack 4. “cd -”を使用して最後に使用した2つのディレクトリの間をいったりきたりする

以下に示したように cd を使用して最後に使用した2つのディレクトリの間をいったりきたりできます。

# cd /tmp/very/long/directory/structure/that/is/too/deep

# cd /tmp/subdir1/subdir2/subdir3

# cd -

# pwd
/tmp/very/long/directory/structure/that/is/too/deep

# cd -

# pwd
/tmp/subdir1/subdir2/subdir3

# cd -

# pwd
/tmp/very/long/directory/structure/that/is/too/deep